[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
mdate-sh borks on uid/gid containing a space
From: |
Dave Korn |
Subject: |
mdate-sh borks on uid/gid containing a space |
Date: |
Wed, 28 Mar 2007 18:01:59 +0100 |
Afternoon all,
As the subject line says, mdate-sh can get badly confused if there are
spaces in the textual version of the uid or gid. I don't know how often this
happens on real unix systems, but it's a very common occurrence on Cygwin
systems, causing this:
/src/nongnu/remake-3.80+dbg-0.61/config $ . ./mdate-sh ../doc/stamp-vti
Users March Mar
because the output from ls -l looks like this:
/src/nongnu/remake-3.80+dbg-0.61/config $ ls -la ../doc/stamp-vti
-rw-r--r-- 1 dk Domain Users 136 Mar 22 16:37 ../doc/stamp-vti
for some files, and like this:
/src/nongnu/remake-3.80+dbg-0.61/config $ ls -l -L -d /
drwxrwx---+ 42 dk Users 0 Mar 27 15:34 /
for others, and so the number of 'shift ;' commands to concatenate into the
'command' variable can be out by one.
The attached patch adds '-n' to the ls commands in mdate-sh, forcing the uid
and gid to be printed as numeric values instead of textual names. Since we're
only discarding them anyway this is the simplest way of guaranteeing they have
no embedded spaces.
The '-n' flag is mandated by the opengroup posix spec for 'ls', but other
than that I don't know how portable it is or is not. The patch is against a
copy of mdate-sh I found in a tarball of 'remake', but I've verified the same
problem still exists in cvs HEAD.
2007-03-28 Dave Korn <address@hidden>
* lib/mdate-sh: Add '-n' switch to 'ls' invocation to avoid parsing
error when uid or gid field contain spaces in textual representation.
cheers,
DaveK
[*] - http://www.opengroup.org/onlinepubs/009695399/utilities/ls.html
--
Can't think of a witty .sigline today....
automake-mdate-space-bug-patch.diff
Description: Binary data
- mdate-sh borks on uid/gid containing a space,
Dave Korn <=