Bug 89655 - symlinks converted from absolute to relative aren't shortened
Summary: symlinks converted from absolute to relative aren't shortened
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: symlinks
Version: 9
Hardware: All
OS: Linux
medium
low
Target Milestone: ---
Assignee: Trond Eivind Glomsrxd
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-04-25 15:22 UTC by Luciano Rocha
Modified: 2007-04-18 16:53 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2003-10-16 12:11:08 UTC
Embargoed:


Attachments (Terms of Use)

Description Luciano Rocha 2003-04-25 15:22:41 UTC
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 12:11:08 UTC
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.