Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #20740 > unrolled thread
| Started by | HoneyMonster <someone@someplace.invalid> |
|---|---|
| First post | 2012-02-23 19:11 +0000 |
| Last post | 2012-02-23 11:26 -0800 |
| Articles | 10 — 8 participants |
Back to article view | Back to comp.lang.python
Just curious: why is /usr/bin/python not a symlink? HoneyMonster <someone@someplace.invalid> - 2012-02-23 19:11 +0000
Re: Just curious: why is /usr/bin/python not a symlink? Colin Higwell <colinh@somewhere.invalid> - 2012-02-23 19:15 +0000
Re: Just curious: why is /usr/bin/python not a symlink? Jerry Hill <malaclypse2@gmail.com> - 2012-02-23 14:24 -0500
Re: Just curious: why is /usr/bin/python not a symlink? HoneyMonster <someone@someplace.invalid> - 2012-02-23 19:34 +0000
Re: Just curious: why is /usr/bin/python not a symlink? Terry Reedy <tjreedy@udel.edu> - 2012-02-23 16:11 -0500
Re: Just curious: why is /usr/bin/python not a symlink? John Roth <johnroth1@gmail.com> - 2012-02-24 09:22 -0800
Re: Just curious: why is /usr/bin/python not a symlink? Jerry Hill <malaclypse2@gmail.com> - 2012-02-23 14:54 -0500
Re: Just curious: why is /usr/bin/python not a symlink? Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2012-02-24 08:47 +0100
Re: Just curious: why is /usr/bin/python not a symlink? Roy Smith <roy@panix.com> - 2012-02-24 08:17 -0500
Re: Just curious: why is /usr/bin/python not a symlink? Chris Rebert <clp2@rebertia.com> - 2012-02-23 11:26 -0800
| From | HoneyMonster <someone@someplace.invalid> |
|---|---|
| Date | 2012-02-23 19:11 +0000 |
| Subject | Just curious: why is /usr/bin/python not a symlink? |
| Message-ID | <ji630k$52f$1@news.albasani.net> |
$ cd /usr/bin $ ls -l python* -rwxr-xr-x 2 root root 9496 Oct 27 02:42 python lrwxrwxrwx 1 root root 6 Oct 29 19:34 python2 -> python -rwxr-xr-x 2 root root 9496 Oct 27 02:42 python2.7 $ diff -s python python2.7 Files python and python2.7 are identical $ I'm just curious: Why two identical files rather than a symlink?
[toc] | [next] | [standalone]
| From | Colin Higwell <colinh@somewhere.invalid> |
|---|---|
| Date | 2012-02-23 19:15 +0000 |
| Message-ID | <ji637l$t5q$1@dont-email.me> |
| In reply to | #20740 |
On Thu, 23 Feb 2012 19:11:16 +0000, HoneyMonster wrote: (reformatted (I hope) > $ cd /usr/bin > $ ls -l python* > -rwxr-xr-x 2 root root 9496 Oct 27 02:42 python > lrwxrwxrwx 1 root root 6 Oct 29 19:34 python2 -> python > -rwxr-xr-x 2 root root 9496 Oct 27 02:42 python2.7 > $ diff -s python python2.7 > Files python and python2.7 are identical > $ > > I'm just curious: Why two identical files rather than a symlink? Sorry, my first post didn't format properly.
[toc] | [prev] | [next] | [standalone]
| From | Jerry Hill <malaclypse2@gmail.com> |
|---|---|
| Date | 2012-02-23 14:24 -0500 |
| Message-ID | <mailman.84.1330025066.3037.python-list@python.org> |
| In reply to | #20740 |
On Thu, Feb 23, 2012 at 2:11 PM, HoneyMonster <someone@someplace.invalid> wrote: > $ cd /usr/bin > $ ls -l python* > -rwxr-xr-x 2 root root 9496 Oct 27 02:42 python > lrwxrwxrwx 1 root root 6 Oct 29 19:34 python2 -> python > -rwxr-xr-x 2 root root 9496 Oct 27 02:42 python2.7 > $ diff -s python python2.7 > Files python and python2.7 are identical > $ > > I'm just curious: Why two identical files rather than a symlink? It's not two files, it's a hardlink. You can confirm by running ls -li python* and comparing the inode numbers. -- Jerry
[toc] | [prev] | [next] | [standalone]
| From | HoneyMonster <someone@someplace.invalid> |
|---|---|
| Date | 2012-02-23 19:34 +0000 |
| Message-ID | <ji64bd$52f$3@news.albasani.net> |
| In reply to | #20742 |
On Thu, 23 Feb 2012 14:24:23 -0500, Jerry Hill wrote: > On Thu, Feb 23, 2012 at 2:11 PM, HoneyMonster > <someone@someplace.invalid> wrote: >> $ cd /usr/bin $ ls -l python* >> -rwxr-xr-x 2 root root 9496 Oct 27 02:42 python lrwxrwxrwx 1 root root >> 6 Oct 29 19:34 python2 -> python -rwxr-xr-x 2 root root 9496 Oct 27 >> 02:42 python2.7 $ diff -s python python2.7 Files python and python2.7 >> are identical $ >> >> I'm just curious: Why two identical files rather than a symlink? > > It's not two files, it's a hardlink. You can confirm by running ls -li > python* and comparing the inode numbers. You are spot on. Thank you, and sorry for my stupidity.
[toc] | [prev] | [next] | [standalone]
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Date | 2012-02-23 16:11 -0500 |
| Message-ID | <mailman.87.1330031526.3037.python-list@python.org> |
| In reply to | #20744 |
On 2/23/2012 2:34 PM, HoneyMonster wrote: > On Thu, 23 Feb 2012 14:24:23 -0500, Jerry Hill wrote: > >> On Thu, Feb 23, 2012 at 2:11 PM, HoneyMonster >> <someone@someplace.invalid> wrote: >>> $ cd /usr/bin $ ls -l python* >>> -rwxr-xr-x 2 root root 9496 Oct 27 02:42 python lrwxrwxrwx 1 root root >>> 6 Oct 29 19:34 python2 -> python -rwxr-xr-x 2 root root 9496 Oct 27 >>> 02:42 python2.7 $ diff -s python python2.7 Files python and python2.7 >>> are identical $ >>> >>> I'm just curious: Why two identical files rather than a symlink? >> >> It's not two files, it's a hardlink. You can confirm by running ls -li >> python* and comparing the inode numbers. > > You are spot on. Thank you, and sorry for my stupidity. The question 'why a hardlink rather than symlink' is not stupid. It was part of the discussion of http://python.org/dev/peps/pep-0394/ The answer was 'history' and how things were 20 years ago and either the pep or the discussion around it says symlinks are fine now and the decision is up to distributors. -- Terry Jan Reedy
[toc] | [prev] | [next] | [standalone]
| From | John Roth <johnroth1@gmail.com> |
|---|---|
| Date | 2012-02-24 09:22 -0800 |
| Message-ID | <e2d8e038-4be4-45e4-b6b0-2d37bbed6c5c@p21g2000yqm.googlegroups.com> |
| In reply to | #20747 |
On Feb 23, 2:11 pm, Terry Reedy <tjre...@udel.edu> wrote: > On 2/23/2012 2:34 PM, HoneyMonster wrote: > > > > > > > > > > > On Thu, 23 Feb 2012 14:24:23 -0500, Jerry Hill wrote: > > >> On Thu, Feb 23, 2012 at 2:11 PM, HoneyMonster > >> <some...@someplace.invalid> wrote: > >>> $ cd /usr/bin $ ls -l python* > >>> -rwxr-xr-x 2 root root 9496 Oct 27 02:42 python lrwxrwxrwx 1 root root > >>> 6 Oct 29 19:34 python2 -> python -rwxr-xr-x 2 root root 9496 Oct 27 > >>> 02:42 python2.7 $ diff -s python python2.7 Files python and python2.7 > >>> are identical $ > > >>> I'm just curious: Why two identical files rather than a symlink? > > >> It's not two files, it's a hardlink. You can confirm by running ls -li > >> python* and comparing the inode numbers. > > > You are spot on. Thank you, and sorry for my stupidity. > > The question 'why a hardlink rather than symlink' is not stupid. It was > part of the discussion ofhttp://python.org/dev/peps/pep-0394/ > The answer was 'history' and how things were 20 years ago and either the > pep or the discussion around it says symlinks are fine now and the > decision is up to distributors. > > -- > Terry Jan Reedy I believe the changes for PEP 394 are using symlinks. The distro maintainer can, of course, change that. John Roth
[toc] | [prev] | [next] | [standalone]
| From | Jerry Hill <malaclypse2@gmail.com> |
|---|---|
| Date | 2012-02-23 14:54 -0500 |
| Message-ID | <mailman.113.1330068784.3037.python-list@python.org> |
| In reply to | #20744 |
On Thu, Feb 23, 2012 at 2:34 PM, HoneyMonster <someone@someplace.invalid> wrote: > On Thu, 23 Feb 2012 14:24:23 -0500, Jerry Hill wrote: >> It's not two files, it's a hardlink. You can confirm by running ls -li >> python* and comparing the inode numbers. > > You are spot on. Thank you, and sorry for my stupidity. I don't think you're stupid. It's hard to tell the difference between two separate files with the same file size and a hardlink. The biggest clue is the number "2" in the second column. If I recall correctly, for directories, that's the number of entries in the directory. For files, that number is the number of hardlinks referring to that file. Even with that, it's hard to tell what files are hardlinked together, and figuring it out by inode is a pain in the neck. Personally, I prefer symlinks, even if they introduce a small performance hit. Readability counts, even in the filesystem. -- Jerry
[toc] | [prev] | [next] | [standalone]
| From | Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> |
|---|---|
| Date | 2012-02-24 08:47 +0100 |
| Message-ID | <ji7fbd$drj$1@r03.glglgl.gl> |
| In reply to | #20785 |
Am 23.02.2012 20:54 schrieb Jerry Hill: > If I recall > correctly, for directories, that's the number of entries in the > directory. No. It is the number of subdirectories (it counts their ".." entries) plus 2 (the parent directory and the own "." entry). > Even with that, it's hard to tell what files are hardlinked together, > and figuring it out by inode is a pain in the neck. Personally, I > prefer symlinks, even if they introduce a small performance hit. Not only that, they have slightly different semantics. With hardlinks you can say "I want this file, no matter if someone else holds it as well". Symlinks say "I want the file which is referred to by there". In the given case, however, this difference doesn't count, and I agree on you that a symlink would be better here. Thomas
[toc] | [prev] | [next] | [standalone]
| From | Roy Smith <roy@panix.com> |
|---|---|
| Date | 2012-02-24 08:17 -0500 |
| Message-ID | <roy-FDAA66.08172524022012@news.panix.com> |
| In reply to | #20787 |
In article <ji7fbd$drj$1@r03.glglgl.gl>, Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> wrote: > Not only that, [hard and symbolic links] have slightly different > semantics. This is true, but only for very large values of "slightly". Symlinks, for example, can cross file system boundaries (including NFS mount points). Symlinks can refer to locations that don't exist! For example: ~$ ln -s foobar foo ~$ ls -l foo lrwxr-xr-x 1 roy staff 6 Feb 24 08:15 foo -> foobar ~$ cat foo cat: foo: No such file or directory Symlinks can be chained (i.e. a symlink points to someplace which in turn is another symlink). They're really very different beasts.
[toc] | [prev] | [next] | [standalone]
| From | Chris Rebert <clp2@rebertia.com> |
|---|---|
| Date | 2012-02-23 11:26 -0800 |
| Message-ID | <mailman.85.1330025198.3037.python-list@python.org> |
| In reply to | #20740 |
On Thu, Feb 23, 2012 at 11:11 AM, Colin Higwell <someone@someplace.invalid> wrote: > $ cd /usr/bin > $ ls -l python* > -rwxr-xr-x 2 root root 9496 Oct 27 02:42 python > lrwxrwxrwx 1 root root 6 Oct 29 19:34 python2 -> python > -rwxr-xr-x 2 root root 9496 Oct 27 02:42 python2.7 > $ diff -s python python2.7 > Files python and python2.7 are identical > $ > > I'm just curious: Why two identical files rather than a symlink? Depends on your distro / installation method: $ ls -l python* lrwxrwxrwx 1 root root 9 Apr 12 2011 python -> python2.6 -rwxr-xr-x 1 root root 2288272 Dec 27 2010 python2.6 $ # this is on my Debian server Cheers, Chris
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web