PR/58577 CVS commit: [netbsd-11] src/usr.bin/xinstall
"Martin Husemann" <[email protected]> Mon, 20 Jul 2026 09:00:02 +0000 (UTC)
| Newsgroups | gmane.os.netbsd.bugs |
|---|---|
| Message-ID | <[email protected]> |
The following reply was made to PR bin/58577; it has been noted by GNATS. From: "Martin Husemann" <[email protected]> To: [email protected] Cc: Subject: PR/58577 CVS commit: [netbsd-11] src/usr.bin/xinstall Date: Mon, 20 Jul 2026 08:55:28 +0000 Module Name: src Committed By: martin Date: Mon Jul 20 08:55:28 UTC 2026 Modified Files: src/usr.bin/xinstall [netbsd-11]: xinstall.c Log Message: Pull up following revision(s) (requested by kre in ticket #389): usr.bin/xinstall/xinstall.c: revision 1.131 PR bin/58577 - install(1) -d issues Fix issues where "install -d" (with no directory) simply exit(0)s. That one is kind of marginal, installing nothing when nothing is needed could be treated as OK, but the man page does indicate in the SYNOPSIS that with -d, at least one directory is needed (it says nothing at all about that in the text). Second, after creating a directory, if a later operation (chown, chmod) fails, that is not success, a warning was issued (good), a bad metalog was being created (bad). That is clearly a bug (though probably doesn't happen very often). And third, when install -d fails, and issues an error, (warn()) the exit status from install(1) should not be zero. This only applies after the (rare, I'd assume) errors from the 2nd fix (which were not previously regarded as errors). The more common failure cases were before, and still are, handled by an immediate err() exit. Patch from the PR (from RVP) installed, plus a couple of changes from me. The method in the patch of just "or"ing the status from the install_dir() would work if install_dir() had been made to return 0 (success) and 1 (failure), but it wasn't, it was made to return EXIT_SUCCESS and EXIT_FAILURE instead. It is wrong to assume those are necessarily 0 and 1. They are for us (and other unix like systems), but not guaranteed. So I modified that code to eliminate that coding technique (I think when creating directories, we can afford one more "if" in the code!) I also added sets of {} around a few large blocks of a single statement that just looked weird (not incorrect) as they were. This thing still needs some KNF surgery however (including, but not limited to, whitespace issues). To generate a diff of this commit: cvs rdiff -u -r1.130 -r1.130.2.1 src/usr.bin/xinstall/xinstall.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.