Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #181811

Re: Automatic updating links?

From Darac Marjal <mailinglist@darac.org.uk>
Newsgroups linux.debian.user
Subject Re: Automatic updating links?
Date 2017-06-06 14:30 +0200
Message-ID <tPlMv-hV-27@gated-at.bofh.it> (permalink)
References <tPkQp-89v-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Tue, Jun 06, 2017 at 12:27:06PM +0100, Rodolfo Medina wrote:
>I wish to create a link to a file that wouldn't break when that file is moved
>on elsewhere in the filesystem or renamed, nay the link would automatically
>`update' pointing at the new name/address of the file.  Is that possible?
>Besides, I wish that form of automatic update also when moving or renaming the
>directory where the link itself lives.

A hardlink might work here.

A symlink (which many people are familiar with) is, essentially, a small
file which says "I am a pointer to /bin/foo". A hardlink, however, is a
second name for a file ("I am both /bin/foo and /bin/bar"). A hardlink
is possible because of the disconnection between a file's directory
entry (i.e. it's name) and the file's contents.

With a hardlink, it is possible to perform certain actions without
breaking the link. You can move one of the files (this just changes that
particular directory entry), you can rename the directory holding the
file(s) (as this doesn't affect the directory entry at all). In certain
circumstances you can even edit the file - as there is only one "file
contents", both files will show identical changes immediately.

There are some restrictions, though. Some file editing operations
involve deleting the original and replacing it with the modified
version. This will break the hardlink (becasue you're essentially saying
"/bin/foo now points to this file" without updaing what /bin/bar points
to). Also, hardlinks are a file-system-specific feature - that is, you
can't hardlink two files on different filesystems.

>
>Thanks for any help,
>
>Rodolfo
>

-- 
For more information, please reread.

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Automatic updating links? Rodolfo Medina <rodolfo.medina@gmail.com> - 2017-06-06 13:30 +0200
  Re: Automatic updating links? <tomas@tuxteam.de> - 2017-06-06 13:50 +0200
  Re: Automatic updating links? Darac Marjal <mailinglist@darac.org.uk> - 2017-06-06 14:30 +0200
  Re: Automatic updating links? Greg Wooledge <wooledg@eeg.ccf.org> - 2017-06-06 14:40 +0200
    Re: Automatic updating links? Rodolfo Medina <rodolfo.medina@gmail.com> - 2017-06-06 19:50 +0200
      Re: Automatic updating links? Greg Wooledge <wooledg@eeg.ccf.org> - 2017-06-06 20:00 +0200
        Re: Automatic updating links? Rodolfo Medina <rodolfo.medina@gmail.com> - 2017-06-06 20:20 +0200
          Re: Automatic updating links? davidson@freevolt.org - 2017-06-06 20:50 +0200
            Re: Automatic updating links? davidson@freevolt.org - 2017-06-06 21:10 +0200
          Re: Automatic updating links? Darac Marjal <mailinglist@darac.org.uk> - 2017-06-07 13:20 +0200
            Re: Automatic updating links? Dan Ritter <dsr@randomstring.org> - 2017-06-15 16:20 +0200
      Re: Automatic updating links? David Wright <deblis@lionunicorn.co.uk> - 2017-06-06 21:00 +0200
        Re: Automatic updating links? Eduardo M KALINOWSKI <eduardo@kalinowski.com.br> - 2017-06-06 21:00 +0200
          Re: Automatic updating links? Rodolfo Medina <rodolfo.medina@gmail.com> - 2017-06-06 21:50 +0200
      Re: Automatic updating links? Eduardo M KALINOWSKI <eduardo@kalinowski.com.br> - 2017-06-06 21:00 +0200

csiph-web