[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: touch

From: Bob Proulx
Subject: Re: touch
Date: Fri, 1 Mar 2002 22:05:36 -0700

> This really isn't a bug, but it looks like there isn't a way to touch a 
> symbolic link. 

That is generally true of BSD like systems which implement symbolic
links.  Actions upon symlinks pass through the symlink and act upon
the target of the symlink.

> If you do a 
> ln -s foo.tgz foo
> touch foo
> it update the date on foo.tgz.

Not of which I am aware.  File times are changed by the utimes(2)
system call.  I know of no lutimes(2) call.  Perhaps others will have
different information.

In order to act upon the symlink special kernel routines need to be
added such as lstat(2) [as opposed to stat(2)] which act upon the
symlink itself.  Fortunately the ower, group, and mode of a symlink
are completely irrelevant to a symlink.

For what purpose would one desire to change the time of a symink?

> Is there a work around?

The only way I know to do this on BSD like systems is to remove and
recreate the symlink.

[I am hoping and assuming that you won't but if you actually did that
I would create one off to the side as a temporarily named object and
then 'mv' it into place since rename(2) is an atomic operation.  That
way the symlink will always exist.  Otherwise there will be a time,
although small, where the symlink will appear not to exist to other
programs and a race condition will be created.  If you cared.]


reply via email to

[Prev in Thread] Current Thread [Next in Thread]