Bug 89655 - symlinks converted from absolute to relative aren't shortened
symlinks converted from absolute to relative aren't shortened
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: symlinks (Show other bugs)
9
All Linux
medium Severity low
: ---
: ---
Assigned To: Trond Eivind Glomsrxd
Ben Levenson
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-04-25 11:22 EDT by Luciano Rocha
Modified: 2007-04-18 12:53 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2003-10-16 08:11:08 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Luciano Rocha 2003-04-25 11:22:41 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030225

Description of problem:
symlinks -c changes absolute links to relative ones. One would expect that the
new links would be as short as possible, ie. that a absolute link to a file in
the same directory would be changed to a relative symlink directly pointing to
the file, not to ../../../../<root>/...../<current dir>/file.

But it doesn't work so, so at least the -s (shorten) should resolve that. And it
does, but only for already relative links. symlinks -sc does the shortening
before the conversition to relative link.


Version-Release number of selected component (if applicable):
1.2-18

How reproducible:
Always

Steps to Reproduce:
1. mkdir -p /tmp/`seq -s/ 1 10`
2. cd !!:2
3. touch a
4. ln -s `pwd`/a b
5. symlinks -sc .
6. symlinks -sc .
    

Actual Results:  5. the symlink b gets changed to
'../../../../../../../../../../../tmp/1/2/3/4/5/6/7/8/9/10/a'
6. the previous symlink is changed to 'a'

Expected Results:  at 5. the symlink should have been changed to 'a', so that
the 6. step wouldn't be required

Additional info:

This is easily fixed calling shorten_path always after fix_abs:
diff -ur symlinks-1.2.old/symlinks.c symlinks-1.2/symlinks.c
--- symlinks-1.2.old/symlinks.c 2003-04-25 15:59:32.000000000 +0100
+++ symlinks-1.2/symlinks.c     2003-04-25 16:20:15.000000000 +0100
@@ -235,6 +235,7 @@
                strcpy (np, tail);
                (void) tidy_path(new);
        }
+       shorten_path(new, path);
        if (!testing) {
                if (unlink (path)) {
                        perror(path);
Comment 1 Florian La Roche 2003-10-16 08:11:08 EDT
Patch is added in -20 or newer to be soon in rawhide.

Thanks for this bug-report,

Florian La Roche

Note You need to log in before you can comment on or make changes to this bug.