Subject: bin/30698: install(1) stripping flags in METALOG [patch]
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: None <j+nbsd@2005.salmi.ch>
List: netbsd-bugs
Date: 07/08/2005 19:21:00
Note: There was a bad value `' for the field `Class'.
It was set to the default value of `sw-bug'.
>Number: 30698
>Category: bin
>Synopsis: install(1) stripping flags in METALOG [patch]
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Jul 08 19:21:00 +0000 2005
>Originator: Jukka Salmi
>Release: NetBSD 3.99.7
>Environment:
System: NetBSD moray.salmi.ch 3.99.7 NetBSD 3.99.7 (GENERIC) #0: Thu Jul 7 16:06:01 CEST 2005 build@moray.salmi.ch:/build/nbsd/i386/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:
If install(1) is passed more than one flag, only the last one
is written to the METALOG.
>How-To-Repeat:
$ touch src
$ install -M log -f arch,opaque src dst
$ cat log
./dst type=file mode=0755 flags=opaque
The `arch' flag is not recorded...
>Fix:
string_to_flags() is the culprit: it uses strsep(3) and thus
changes fflags. Probably the easiest solution is to restore
fflags from fileflags:
Index: xinstall.c
===================================================================
RCS file: /cvsroot/src/usr.bin/xinstall/xinstall.c,v
retrieving revision 1.91
diff -u -r1.91 xinstall.c
--- xinstall.c 11 Jun 2005 22:59:05 -0000 1.91
+++ xinstall.c 8 Jul 2005 19:05:24 -0000
@@ -310,6 +310,8 @@
if (fflags && !dounpriv) {
if (string_to_flags(&fflags, &fileflags, NULL))
errx(1, "%s: invalid flag", fflags);
+ /* restore fflags since string_to_flags() changed it */
+ fflags = flags_to_string(fileflags, "-");
iflags |= SETFLAGS;
}
#endif