From: Sebastien Barre <Sebastien.Barre@utc.fr>
To: cygwin@sourceware.cygnus.com
Subject: [HELP] stat(), file permission, r/w access : i'm LOST :(
Date: Wed, 31 Mar 1999 19:45:00 -0000 [thread overview]
Message-ID: <4.1.19990301211226.016b1250@mail.club-internet.fr> (raw)
Message-ID: <19990331194500.uO2hE9_tcSsmYLOb-bjfoGeGOyvBGuSU1s-psnqgviA@z> (raw)
In-Reply-To: <4.1.19990301145716.017379b0@mail.club-internet.fr>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 4450 bytes --]
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@sourceware.cygnus.com
next prev parent reply other threads:[~1999-03-31 19:45 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-02-28 16:22 Cygwin participation threshold Christopher G. Faylor
[not found] ` < 199903010022.QAA07416@rtl.cygnus.com >
1999-02-28 17:52 ` mySQL, mSQL, PostgreSQL with cygwin ? Sebastien Barre
1999-02-28 23:02 ` Sebastien Barre
1999-02-28 23:02 ` Stipe Tolj
1999-03-01 6:09 ` Sebastien Barre
[not found] ` < 4.1.19990301145716.017379b0@mail.club-internet.fr >
1999-03-01 13:28 ` Sebastien Barre [this message]
[not found] ` < 4.1.19990301211226.016b1250@mail.club-internet.fr >
1999-03-01 13:42 ` [HELP] stat(), file permission, r/w access : i'm LOST :( Larry Hall (RFK Partners, Inc)
[not found] ` < 3.0.3.32.19990301163809.00994e00@pop.ma.ultranet.com >
1999-03-01 14:34 ` Sebastien Barre
[not found] ` < 4.1.19990301232226.01717350@mail.club-internet.fr >
1999-03-01 14:47 ` Larry Hall (RFK Partners, Inc)
[not found] ` < 3.0.3.32.19990301174320.0098ad30@pop.ma.ultranet.com >
1999-03-02 1:02 ` Sebastien Barre
1999-03-02 3:26 ` Heinz-Jürgen Oertel
1999-03-31 19:45 ` Heinz-Jürgen Oertel
[not found] ` < 4.1.19990302094806.016bc410@mail.club-internet.fr >
1999-03-02 23:55 ` Geoffrey Noer
1999-03-31 19:45 ` Geoffrey Noer
1999-03-31 19:45 ` Sebastien Barre
1999-03-02 3:04 ` Lassi A. Tuura
1999-03-31 19:45 ` Lassi A. Tuura
1999-03-06 2:49 ` Sebastien Barre
[not found] ` < 4.1.19990305214515.016caba0@mail.club-internet.fr >
1999-03-06 11:04 ` Larry Hall
1999-03-31 19:45 ` Larry Hall
1999-03-31 19:45 ` Sebastien Barre
1999-03-31 19:45 ` Larry Hall (RFK Partners, Inc)
1999-03-31 19:45 ` Sebastien Barre
1999-03-31 19:45 ` Larry Hall (RFK Partners, Inc)
1999-03-01 13:55 ` John Fortin
[not found] ` < 36DB0B4F.8FC8757@ibm.net >
1999-03-01 14:33 ` Sebastien Barre
[not found] ` < 4.1.19990301232512.01714e60@mail.club-internet.fr >
1999-03-01 14:39 ` DJ Delorie
1999-03-31 19:45 ` DJ Delorie
1999-03-31 19:45 ` Sebastien Barre
1999-03-31 19:45 ` John Fortin
1999-03-31 19:45 ` Sebastien Barre
1999-03-07 9:11 ` mySQL, mSQL, PostgreSQL with cygwin ? Stipe Tolj
1999-03-31 19:45 ` Stipe Tolj
1999-03-31 19:45 ` Sebastien Barre
1999-02-28 23:02 ` Cygwin participation threshold Christopher G. Faylor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4.1.19990301211226.016b1250@mail.club-internet.fr \
--to=sebastien.barre@utc.fr \
--cc=cygwin@sourceware.cygnus.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).