Bug 101653 - Need chroot option for symlinks
Summary: Need chroot option for symlinks
Keywords:
Status: ASSIGNED
Alias: None
Product: Fedora
Classification: Fedora
Component: symlinks
Version: rawhide
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Tim Waugh
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-08-05 09:27 UTC by P Fudd
Modified: 2012-06-07 12:19 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: ---
Embargoed:


Attachments (Terms of Use)

Description P Fudd 2003-08-05 09:27:32 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030225

Description of problem:
I copied the entire filesystem of another computer to a subdirectory on my
computer.  The filesystem had absolute links, which now point to the wrong
places.  The thing to do is to make these links relative instead of absolute,
and the 'symlinks' program is just the tool to do it.  

Except that it can't.

I've patched symlinks to have one more command line option: '-C', chroot to
current directory.  This solves my problem, as in:

  symlinks -C -r -c /



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

How reproducible:
Always

Steps to Reproduce:
1. Copy a filesystem with absolute symlinks to a subdirectory
2. Try to fix the symlinks
3. 
    

Actual Results:  'symlinks -c -r /my/directory' replaces absolute links with
absolutely wrong relative links.

Expected Results:  The right relative links should have been created.

Additional info:

Here's a patch:
diff -ru symlinks-1.2/symlinks.c src/symlinks.c
--- symlinks-1.2/symlinks.c     1996-10-15 12:02:57.000000000 -0700
+++ src/symlinks.c      2003-08-05 01:34:27.000000000 -0700
@@ -285,9 +285,10 @@
 static void usage_error (void)
 {
        fprintf(stderr, progver, progname);
-       fprintf(stderr, "Usage:\t%s [-crsv] dirlist\n\n", progname);
+       fprintf(stderr, "Usage:\t%s [-crsvC] dirlist\n\n", progname);
        fprintf(stderr, "Flags:\t-c == change absolute/messy links to relative\n"
                "\t-d == delete dangling links\n"
+               "\t-C == chroot to the current directory before looking at
dirlist\n"
                "\t-r == recurse into subdirs\n"
                "\t-s == shorten lengthy links\n"
                "\t-v == verbose (show all symlinks)\n\n");
@@ -324,6 +325,7 @@
                                else if (c == 'd')      delete    = 1;
                                else if (c == 's')      shorten   = 1;
                                else if (c == 't')      testing   = 1;
+                               else if (c == 'C')      chroot(".");
                                else                    usage_error();
                        }
                } else {



####
Note, this is crude, and doesn't do any error checking, and you need to be root
for chroot to work, and so on and so forth.  To do it right I would have to have
replaced way more code and fixed the man page, but I have a job to finish.

Enjoy!

Comment 1 Bill Nottingham 2006-08-05 04:34:18 UTC
Red Hat apologizes that these issues have not been resolved yet. We do want to
make sure that no important bugs slip through the cracks.

Red Hat Linux 7.3 and Red Hat Linux 9 are no longer supported by Red Hat, Inc.
They are maintained by the Fedora Legacy project (http://www.fedoralegacy.org/)
for security updates only. If this is a security issue, please reassign to the
'Fedora Legacy' product in bugzilla. Please note that Legacy security update
support for these products will stop on December 31st, 2006.

If this is not a security issue, please check if this issue is still present
in a current Fedora Core release. If so, please change the product and version
to match, and check the box indicating that the requested information has been
provided.

If you are currently still running Red Hat Linux 7.3 or 9, please note that
Fedora Legacy security update support for these products will stop on December
31st, 2006. You are strongly advised to upgrade to a current Fedora Core release
or Red Hat Enterprise Linux or comparable. Some information on which option may
be right for you is available at http://www.redhat.com/rhel/migrate/redhatlinux/.

Any bug still open against Red Hat Linux 7.3 or 9 at the end of 2006 will be
closed 'CANTFIX'. Again, if this bug still exists in a current release, or is a
security issue, please change the product as necessary. We thank you for your
help, and apologize again that we haven't handled these issues to this point.


Comment 2 P Fudd 2006-08-05 19:13:26 UTC
This issue is still present in Fedora Core 5.

Comment 3 petrosyan 2008-03-10 05:49:59 UTC
Fedora Core 5 is no longer maintained. Is this bug still present in Fedora 8?

Comment 4 Penelope Fudd 2008-03-10 06:19:18 UTC
Well, it is present in Fedora 7; as far as I can tell, it will also be present
in Fedora 8.  

Just run it with no arguments.  If it doesn't mention an option for changing the
root of the directory tree (with a chroot() system call) before starting, then
the bug (or 'lack of feature') is still present.

Thanks for looking at this after all these years!

Comment 5 Bug Zapper 2008-11-26 06:46:59 UTC
This message is a reminder that Fedora 8 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 8.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '8'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 8's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 8 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping


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