public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "Tweedy, Laura" <l.tweedy@clairvoyancecorp.com>
To: "'cygwin@sourceware.cygnus.com'" <cygwin@sourceware.cygnus.com>
Subject: ln -f changes permissions on NT
Date: Mon, 18 Sep 2000 12:53:00 -0000	[thread overview]
Message-ID: <DDFE2CAB87ECD311B02D0000929695E20EBCDB@WOTAN> (raw)

Hello...

I am running into permission problems with ln -f.  I have a file that
is read-only and I want it to remain so.  I am making a hard link to
it in another location.  This link is done in a makefile which uses
ln -f to make the link.  The link works fine, but if making the target
requires that it be removed first, the permissions become read-write.

I believe this is the result of the target being forcibly removed
before it is linked again.  I saw in the source (for ln or _unlink, I
can't remember) that when files are read-only but are being removed
anyway, their permissions are changed and the remove is tried again.
I think this "transient" permission for the file is sticking around
longer than intended.

On Unix (I tried Solaris and Linux), ln -f keeps the permissions of
the source file, even if the target has to be removed.  On NT, the
permissions necessary to removed the target stay around.

This problem of transient permissions is evident in rm -f too.  On
Unix, rm -f keeps the permissions on the other links while removing
one of the links.  On NT, the permissions for removing stay around.

Below is a transcript showing NT vs. Solaris and their behaviours.
I am looking for a work-around, but I thought I would report it
anyway in case it hasn't been reported.  I'm running with the 1.1.2
cygwin DLL (I think).  I didn't see in the changes for 1.1.4 that this
was fixed, but I haven't tried it.  My apologies if it's fixed there.

Thanks!
laura

NT:
d:\>ls -l foo
-r--r--r--   1 tweedy   Administ       13 Sep 18 15:35 foo

d:\>ln -f foo bar

d:\>ls -l foo bar
-r--r--r--   2 tweedy   Administ       13 Sep 18 15:35 bar
-r--r--r--   2 tweedy   Administ       13 Sep 18 15:35 foo

d:\>ln -f foo bar

d:\>ls -l foo bar
-rw-r--r--   2 tweedy   Administ       13 Sep 18 15:35 bar
-rw-r--r--   2 tweedy   Administ       13 Sep 18 15:35 foo

d:\>

Solaris:
quadsun: ~ 20 > ls -l foo
-r--r--r--   1 tweedy   users         12 Sep 14 16:06 foo
quadsun: ~ 21 > ln -f foo bar
quadsun: ~ 22 > ls -l foo bar
-r--r--r--   2 tweedy   users         12 Sep 14 16:06 bar
-r--r--r--   2 tweedy   users         12 Sep 14 16:06 foo
quadsun: ~ 23 > ln -f foo bar
ln: foo and bar are identical
quadsun: ~ 24 > ls -l foo bar
-r--r--r--   2 tweedy   users         12 Sep 14 16:06 bar
-r--r--r--   2 tweedy   users         12 Sep 14 16:06 foo
quadsun: ~ 25 > 



NT:
d:\>ls -l foo bar
-r--r--r--   2 tweedy   Administ       13 Sep 18 15:35 bar
-r--r--r--   2 tweedy   Administ       13 Sep 18 15:35 foo

d:\>rm -f bar

d:\>ls -l foo
-rw-r--r--   1 tweedy   Administ       13 Sep 18 15:35 foo

d:\>

Solaris:
quadsun: ~ 29 > ls -l foo bar
-r--r--r--   2 tweedy   users         12 Sep 14 16:06 bar
-r--r--r--   2 tweedy   users         12 Sep 14 16:06 foo
quadsun: ~ 30 > rm -f bar
quadsun: ~ 31 > ls -l foo
-r--r--r--   1 tweedy   users         12 Sep 14 16:06 foo
quadsun: ~ 32 > 

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

             reply	other threads:[~2000-09-18 12:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-09-18 12:53 Tweedy, Laura [this message]
2000-09-18 15:48 ` Chris 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=DDFE2CAB87ECD311B02D0000929695E20EBCDB@WOTAN \
    --to=l.tweedy@clairvoyancecorp.com \
    --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).