[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: group names with spaces
From: |
Jim Meyering |
Subject: |
Re: group names with spaces |
Date: |
Wed, 11 Jun 2008 11:54:17 +0200 |
Bruno Haible <address@hidden> wrote:
> Building coreutils-6.12.29-a16be on the td152.testdrive.hp.com machine
> yields a test failure for me. Log attached below. In short, the problem is
> that GNU chown fails to parse a USER:GROUP specification if the GROUP
> contains spaces.
>
> $ id
> uid=90719(bhaible2) gid=513(Domain Users) groups=513(Domain Users)
> $ ls -ld .
> drwxr-xr-x 9 bhaible2 Domain Users 4096 Jun 10 19:29 .
> $ touch foo
> $ src/chown 'bhaible2:Domain Users' foo
> src/chown: invalid group: `bhaible2:Domain Users'
Thanks for reporting that.
However, it's not really a parsing problem,
since GNU chown has no trouble parsing the strings.
The failure is that FreeBSD's getgrnam returns NULL
when given a string containing a space like that.
If the C library prevents chown(1) from mapping a
group name to a group ID, then it can't do its job.
I'm inclined simply to write this off as a misconfigured
system, since the vendor-supplied chown fails in a similar manner.
Using coreutils' chown:
td152$ ./chown '80798:Domain Users' .
./chown: invalid group: `80798:Domain Users'
Using FreeBSD 6.2's chown:
td152$ /usr/sbin/chown '80798:Domain Users' .
chown: Domain Users: Invalid argument
However, I've gone ahead and arranged to skip that test with
the combination of FreeBSD 6.x and a losing group name:
>From 47ed009e5742f2ba396194d5faac35eb0587d220 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Wed, 11 Jun 2008 11:52:03 +0200
Subject: [PATCH] tests: skip a chown test on FreeBSD 6.x
* tests/chown/separator: Skip this test if is likely to fail
due to the combination of a bogus group name and a broken
getgrnam function.
---
tests/chown/separator | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/tests/chown/separator b/tests/chown/separator
index eaf27b6..cfd5f0c 100755
--- a/tests/chown/separator
+++ b/tests/chown/separator
@@ -35,6 +35,17 @@ test -n "$id_g" || framework_failure
id_gn=`id -gn` || framework_failure
test -n "$id_gn" || framework_failure
+# FreeBSD 6.x's getgrnam fails to look up a group name containing
+# a space. On such a system, skip this test if the group name contains
+# a byte not in the portable filename character set.
+case $host_triplet in
+ *-freebsd6.*)
+ case $id_gn in
+ *[^a-zA-Z0-9._-]*) skip_test_ "invalid group name: $id_gn";;
+ esac;;
+ *) ;;
+esac
+
fail=0
chown '' . || fail=1
--
1.5.6.rc2.17.ge9e7