Mail Archives: cygwin/1999/03/01/16:29:12
Dear cygwin people
As some of you might have noticed (sorry for the flood), I'm still trying
to arbitrate The Fight between Perl 5.002 and cygwin32-B20.1 (the
battlefield being NT4/SP4). Well, thanks to some of you, I nearly did it
(and also ruined a couple of nights), but a strange problem lead me to some
more confusion :
Problem : although I'm working as single user on a standalone workstation,
and always logged as sysadmin ("administrateur" in french), cygwin seems to
see/create the files on my hard disk as *not* belonging to me, but to
another "being" (which is not obvious to me).
I'll do my best to describe it (it's really *easy* to observe) : let's have
a look at a simple Perl example, then a short C example with stat(), and my
/etc/passwd and /etc/group. Finally I will create a simple file with
'touch', and you will notice that it will be reported as NOT belonging to
me and not being writable :((
Note : this seems specific to NT, which is not surprising regarding file
permissions.
Perl example :
----------------------
Note : I created /etc/passwd and /etc/group with 'mkpasswd -l' and 'mkgroup
-l' respectively, as reported in many FAQS.
administrateur [26] /etc$ perl -e 'print "yes" if -w "group";'
administrateur [27] /etc$ ll
total 7
-rw-r--r-- 1 544 Aucun 27 Feb 26 02:45 group
-rw-r--r-- 1 544 Aucun 65 Mar 1 21:08 passwd
-rw-r--r-- 1 544 Aucun 9828 Dec 1 14:00 termcap
That command (-w) will display 'yes' if the file (here, /etc/group) is
writable. Apparently, it fails. And fails everywhere in my filesystem. The
'-w' command is using C<stat>, let's move on :
C example :
----------------------
#include <sys/stat.h>
#include <stdlib.h>
int main() {
struct stat mystat;
stat("group", &mystat);
printf("mode : %o, uid : %u, gid : %u\n",
mystat.st_mode, mystat.st_uid, mystat.st_gid);
exit(0);
}
Run :
administrateur [52] /etc$ gcc mystat.c
administrateur [53] /etc$ a.exe
mode : 100644, uid : 544, gid : 513
administrateur [55] /etc$ ll group
-rw-r--r-- 1 544 Aucun 27 Feb 26 02:45 group
Which means :
- /etc/group belongs to user which UID is 544, and to group which GID is 513
- it's a regular file (100000),
- read/write permission to owner (600), read permission to group (40) and
read to other (4).
BUT (and it drives me crazy). I CREATED that file, and I'm NOT user 544 !
(more about this strange fellow below).
administrateur [56] /etc$ whoami
administrateur
administrateur [74] /etc$ cat passwd
Administrateur::500:513:seb::/bin/sh
InvitÚ::501:513:::/bin/sh
administrateur [75] /etc$ cat group
Aucun::513:
Everyone::0:
Obviously, I'm user 500 (I changed my name to 'seb' so that to check).
=> Therefore WHY are all files created as 544 (even with tar) ? (the group
is correct : 513).
I thought it was related to /etc/passwd, but I just do NOT UNDERSTAND the
difference between -l and -g option for 'mkpasswd'.
-l,--local print local accounts
-g,--local-groups print local group information too
administrateur [77] /etc$ mkpasswd -l
Administrateur::500:513:seb::/bin/sh
InvitÚ::501:513:::/bin/sh
administrateur [79] /etc$ mkpasswd -g
Administrateurs::544:0:::
Duplicateurs::552:0:::
InvitÚs::546:0:::
OpÚrateurs de sauvegarde::551:0:::
Utilisateurs::545:0:::
Utilisateurs avec pouvoir::547:0:::
=> who are these users ?!? these should be groups !! I'm belonging to the
"Administrateurs" group for NT (in the "Gestionnaire d'utilisateurs" ~=
"User manager"), and this has been translated to a user, I'm completely
lost :((
=> dumping 'mkpasswd -l -g' to /etc/passwd (instead of 'mkpasswd -l') did
NOT help.
Here is the same joke :
administrateur [84] /etc$ touch test
administrateur [85] /etc$ ll test
-rw-r--r-- 1 544 Aucun 0 Mar 1 21:46 test
administrateur [86] /etc$ perl -e 'print "yes" if -w "test";'
administrateur [87] /etc$
WOAH : I created a file, and it's automatically assigned to someone else !
Give me my file back please :(
And of course, although I created it, it's now NOT writable for cygwin.
I guess I might be just dumb. Any help would be really appreciated (by my
mental health).
Thanks
______________________________________________________________
Sebastien Barre http://www.hds.utc.fr/~barre/
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
- Raw text -