Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Changing symlinks mod time.....

10 views
Skip to first unread message

M Pavan Kumar Reddy

unread,
Jul 3, 2001, 3:21:11 AM7/3/01
to
Hi,
I want to change the modification time of a symbolic link. I used
utimes to change for a regular file/directory. If I try to do the same
on a symbolic link its changing the modification time of the actual
file. i.e in this case /home/drass/mpavan/truss.

lrwxrwxrwx 1 mpavan system 24 Feb 22 14:24 truss ->
/home/drass/mpavan/truss

I dont want to traverse the path for a symbolic link and change the
time.

Any help is appreciated.

Cheers.....,
Pavan

Barry Margolin

unread,
Jul 3, 2001, 11:03:22 AM7/3/01
to
In article <3B417267...@Digital.com>,

Unless the time you want to set it to is *now*, I don't think you can do
this in my Unix versions without writing to the disk directly. If you want
to set it to now, remove the symlink and create a new one.

Why do you need to do this, anyway? The timestamps of a symlink aren't
generally used for anything.

--
Barry Margolin, bar...@genuity.net
Genuity, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

Nithyanandham

unread,
Jul 3, 2001, 11:27:58 AM7/3/01
to

Impossible unless you do it in a nasty way. But, why do you want to do it.?


--

Nithyanand.
Siemens, Bangalore, India.
(Opinions expressed are my own and do not reflect the opinions of my employer,
Siemens)

M Pavan Kumar Reddy

unread,
Jul 4, 2001, 2:54:38 AM7/4/01
to
I want to restore the time stamp of the symlink while doing a restore
from a tape to my disk.
-Pavan

Joe Durusau

unread,
Jul 5, 2001, 10:16:28 AM7/5/01
to
The underlying question everyone is trying to ask is:

"What do you hope to accomplish by changing the timestamp of a
symlink??? No one
can think of any case in which the timestamp of a symlink is used for
anything."


Speaking only for myself,

Joe Durusau

M Pavan Kumar Reddy

unread,
Jul 6, 2001, 5:56:10 AM7/6/01
to
I wanted to know why the symbolic links are not getting changed? Why
shoudnt the origianal time(i.e the time when they are created) should be
there? Even 'tar' utility works the same way. It doesn't restore the
time for symbolic link where as it restores for files & directories. Why
symlink special?????
-Pavan

Barry Margolin

unread,
Jul 6, 2001, 12:02:51 PM7/6/01
to
In article <3B458B3A...@Digital.com>,

M Pavan Kumar Reddy <pavan...@Digital.com> wrote:
>I wanted to know why the symbolic links are not getting changed? Why
>shoudnt the origianal time(i.e the time when they are created) should be
>there? Even 'tar' utility works the same way. It doesn't restore the

The reason is that there's no Unix system call that tar could use to set
the time of a symlink. The utime() syscall follows links.

>time for symbolic link where as it restores for files & directories. Why
>symlink special?????

Most operations on symlinks are automatically propagated to the target of
the link, unless there's a need to be able to be able to operate on the
symlink itself. For instance, it's obviously necessary to be able to
remove symlinks, so unlink() doesn't follow the link. But since the times
of symlinks aren't used for anything important, utime() follows links.

0 new messages