[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: touch
From: |
anon |
Subject: |
Re: touch |
Date: |
Mon, 4 Mar 2002 11:17:42 -0700 (MST) |
This function may not be that generally useful. I write security software
and it helps give the software hints if I can adjust the dates on the
symbolic links. That way I don't have 2 minute cron jobs running every
hour.
If I wrote an ltouch would it be useful enough to include in the source or
should I just drop it only sourceforge? I guess I'd have to convince ppl
to accept the kernel patches as well, but that's probably do-able.
Jason
address@hidden
On Fri, 1 Mar 2002, Bob Proulx wrote:
>
> > 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.]
>
> Bob
>