[net.bugs.4bsd] using utimes

simsong@mit-eddie.UUCP (Simson L. Garfinkel) (07/29/85)

Replace this line with your message

How do you do this? According to both the man page and experimentation,
utimes chases the link and sets the time of the file pointed to. So how
do you set the time of the link itself?

				Simson L. Garfinkel

gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) (07/30/85)

Why are there so many inquiries about doing things to the symbolic
links instead of to the files to which they point?  It doesn't seem
to be necessary..

simsong@mit-eddie.UUCP (Simson L. Garfinkel) (07/30/85)

In article <266@brl-tgr.ARPA> gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) writes:
>Why are there so many inquiries about doing things to the symbolic
>links instead of to the files to which they point?  It doesn't seem
>to be necessary..


Because I am writing a parallel file system that uses write once compact
disks. I would like it if, when a symbolic link is restored with some
sort of "preserve original times" option is specified, the links get
restored with the same time as when they were created.

If anybody would like info on the Compact Disk File System (by the way:
It's opperating system independent!) I would be happy to post an article
about it.

				Simson L. Garfinkel
				Art and Media Technology Labortory
				MIT

					simsong@athena.mit.edu
					simsong@mit-multics.arpa
					...eddie!simsong.uucp

arnold@gatech.CSNET (Arnold Robbins) (07/31/85)

In article <266@brl-tgr.ARPA>, gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) writes:
> Why are there so many inquiries about doing things to the symbolic
> links instead of to the files to which they point?  It doesn't seem
> to be necessary..

It sure is necessary if you're writing/using a file system backup program.
I've been converting a really nice program from System V to 4.2 BSD, and
symbolic links have been the hardest part.  As it currently stands, when
restoring a symbolic link, you can't restore the mod time on the link itself,
or change the mode. (In fact, I have to now add code to check for that!)

I hope 4.3 cleans up some of their semantics.  For instance, the following
code creates a symlink that 'ls' says is l--------- (mode 000):

	...
	umask (0777);
	symlink ("old", "new");
	...

'new' is mode 000, but a readlink(new,...) will succeed!  I'm not sure exactly
what should happen, but I don't think the readlink should succeed.

In sum, I think symbolic links are nifty things, but there are some things
about them that could use redefining (or at least clarifying).
-- 
Arnold Robbins
CSNET:	arnold@gatech	ARPA:	arnold%gatech.csnet@csnet-relay.arpa
UUCP:	{ akgua, allegra, hplabs, ihnp4, seismo, ut-sally }!gatech!arnold

Hello. You have reached the Coalition to Eliminate Answering Machines.
Unfortunately, no one can come to the phone right now....

acheng@uiucdcs.Uiuc.ARPA (08/05/85)

>/* Written 12:23 pm  Jul 31, 1985 by arnold@gatech.CSNET in uiucdcs:net.bugs.4bsd */
>In article <266@brl-tgr.ARPA>, gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) writes:
>> Why are there so many inquiries about doing things to the symbolic
>> links instead of to the files to which they point?  It doesn't seem
>> to be necessary..
>
>It sure is necessary if you're writing/using a file system backup program.
>I've been converting a really nice program from System V to 4.2 BSD, and
>symbolic links have been the hardest part.  As it currently stands, when
>restoring a symbolic link, you can't restore the mod time on the link itself,
>or change the mode. (In fact, I have to now add code to check for that!)
>...
>Arnold Robbins
>CSNET:	arnold@gatech	ARPA:	arnold%gatech.csnet@csnet-relay.arpa
>UUCP:	{ akgua, allegra, hplabs, ihnp4, seismo, ut-sally }!gatech!arnold
>/* End of text from uiucdcs:net.bugs.4bsd */

I was trapped by the symbolic pointer too.  I once created a symbolic
pointer under root uid to point at a directory i just moved to a
new location.  But my root uid has a umask of 066 to make sure
I won't accidentally leave sensitive files around for public access
(I know, you may object to the umask value, but...)  Well, the symbolic
pointer is not accessible by anyone but root.  So i "chmod" its mode
but ended up screwing up the real directory.  Finally, i changed my
umask to 0, removed and recreated the symbolic link.  It was no big
deal, but i wonder if there is an easy way to change the mode of the
symbolic link.  How about a "chmod -l <mode> file"?


albert cheng
acheng@uiuc.ARPA	acheng@uiuc.CSNET	{ihnp4,pur-ee}!uiucdcs!acheng

Univ. of Illinois-Urbana where the Fighting Illini live.

chris@umcp-cs.UUCP (Chris Torek) (08/07/85)

Once again: the owner, mode, and times of a symbolic link are never
used by anything in the kernel, so changing them is pointless anyway.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 4251)
UUCP:	seismo!umcp-cs!chris
CSNet:	chris@umcp-cs		ARPA:	chris@maryland

kre@ucbvax.ARPA (Robert Elz) (08/09/85)

In article <1139@umcp-cs.UUCP>, chris@umcp-cs.UUCP (Chris Torek) writes:
> Once again: the owner, mode, and times of a symbolic link are never
> used by anything in the kernel, so changing them is pointless anyway.

Almost.  The owner is used to account for the space (1 block)
used by the symbolic link in disc quota calculations.  You
can chown() symbolic links to alter who is charged this way.

Apart from that, symbolic links are intended (as much as
is possible) to emulate real links, chmod(), utimes() etc
all alter the file linked to, just as if it was a hard link.

Robert Elz			ucbvax!kre kre@monet.berkeley.edu