For example, from the referenced PR [1]:
$ mkdir /tmp/lib/ /tmp/libexec
$ touch /tmp/lib/foo.so
$ install -lrs /tmp/lib/foo.so /tmp/libexec/
The common path identification bits terminate src at /tmp/lib/ and the
destination at /tmp/libe. The subsequent backtracking is then incorrect, as
it traverses the destination and backtraces exactly one level while eating
the 'libexec' because it was previously (falsely) identified as common with
'lib'.
The obvious fix would be to make sure we've actually terminated just after
directory separators and rewind a character if we haven't. In the above
example, we would end up rewinding to /tmp/ and subsequently doing the right
thing.
Test case added.
PR: 235330 [1]
MFC after: 1 week
I need these tools in order to install the crossbuilt FreeBSD and create a
disk image. Linux does not have a st_flags in struct stat so unfortunately
I need a bunch of ugly ifdefs. The resulting binaries allow me to
sucessfully install a MIPS64 world and create a disk-image that boots.
Reviewed By: brooks, bdrewery, emaste
Approved By: jhb (mentor)
Differential Revision: https://reviews.freebsd.org/D13307
Mainly focus on files that use BSD 3-Clause license.
The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.
Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
If stat continues to fail with ENOENT and mkdir with EEXIST the code wont
finish. In particular this can show up when the target path follows through
a symlink to a non-existent directory.
Reported by: ae
MFC after: 1 week
It was unlinking the target even though it uses rename(2) which already
effectively does that. -S is intended to not unlink(2) the target first.
MFC after: 1 week
Reviewed by: jhb
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D7452
With both of these flags, the backup was created via rename(dest, backup)
followed by rename(tmp, dest). This left the destination file missing
for a moment which contradicts the point of -S.
This fixes a race with installworld where PRECIOUSPROG and PRECIOUSLIB
files (which use -S for installation) would briefly be missing. In the
case of installing rtld with parallel installworld it could render an
error due to not having rtld present to run install/cp in another
process.
Reported by: jhb
Reviewed by: jhb
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D7451
This is a minor nit after r289391 made all installations to a directory always
end in a trailing '/'.
MFC after: 3 days
Sponsored by: EMC / Isilon Storage Division
This should fix the build on older stable/10, since install is a bootstrap
tool.
Pending a decision how to fix this properly, revert utimensat usage. Copies
with the -p option will again appear older than the original almost always,
but -p is not commonly used.
In case the target of install is a dead symlink, install(1) used to not
consider it as "existing" because of the usage of stat(2) instead of
lstat(2). meaning the old file (the symlink) is not removed before the new
file is created. The symlink is being followed and the new file becoming the
target of the symlink instead of the target of install(1)
Reviewed by: jhb, brooks
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D4191
When requesting install(1) to only make relative symlinks, by pass all the
done to actually compute the relative symlink if the path given in argument is
already a relative path
Since the code stats and mkdirs in 2 separate steps, it is possible that
the directory will be created in the meantime by something else (e.g.
concurrent install).[1]
While here alter the code to properly report stat failure, previously it
would always claim it was mkdir which failed.
Noted by: royger [1]
MFC after: 1 week
Instead, change arguments of internal function digest_update() to accept
signed char arguments.
Remove MAP_FAILED fallback definition and casts of MAP_FAILED.
Thanks to bde@ for looking over this and doing the code analysis.
* -M <metalog> Log metadata in mtree format.
* -D <destdir> Log paths relative to <destdir>.
* -h <hash> Log digest of type <hash>.
* -T <tags> Specify which mtree tags to log.
* -l <linkflag> Create hard or symbolic links (allows logging).
* -U Install without root privileges (owner, group, mode,
and flags can be logged via -M
NOTE: In the interest of compatibility with NetBSD and because it is the
obvious letter, the nearly useless -M option (disable mmap) has been
repurposed.
Sponsored by: DARPA, AFRL
Obtained from: NetBSD
Reviewed by: bz
group file to be used. This is useful for installing on systems where
a user or group does not currently exist.
Sponsored by: DARPA, AFRL
Obtained from: NetBSD
MFC after: 5 days
Sync up with flags understood by install(1) [1], and make install(1)'s
usage output not hide the clearly documented -M flag.
PR: misc/154739 [1]
Submitted by: arundel
is in accordance with the information provided at
ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change
Also add $FreeBSD$ to a few files to keep svn happy.
Discussed with: imp, rwatson
- Sort function prototypes;
- Apply static on all function bodies. To quote bde@:
> It is a good obfuscation to declare functions as static only in the
> prototype, so that you can't see the static for the actual function.
> The reverse obfuscation (with static only in the function definition)
> would make more sense, but is a constraint error.
Reviewed by: bde
because of the absence of a destination directory or if the
"destination directory" is not a directory.
PR: bin/11826
Submitted by: Denis Eremenko <moonshade@pnhz.kz>
Approved by: grog@
X-MFC after: various freezes
for a lot of unrelated error conditions, at least report the line
number where it bailed.
Don't use multiline string literals for Usage, gcc 3.3 doesn't like them.
the deprecated utime(3). utimes(2) uses timeval, but utime(3) uses
time_t's. If you do bad things (like I did) by mixing up include files
with libc, then install can do strange things if you mismatch the time_t
stuff. utime() is emulated entirely within libc.
Approved by: re (jhb)
Add some constness to avoid some warnings.
Remove use register keyword.
Deal with missing/unneeded extern/prototypes.
Some minor type changes/casts to avoid warnings.
Reviewed by: md5