|
Rachel Sibley |
bb681e |
PURPOSE of /CoreOS/coreutils/readlink-cannot-handle-recursive-symlinks
|
|
Rachel Sibley |
bb681e |
Description: Test for readlink cannot handle recursive symlinks
|
|
Rachel Sibley |
bb681e |
Author: Jan Scotka <jscotka@redhat.com>
|
|
Rachel Sibley |
bb681e |
Bug summary: readlink cannot handle recursive symlinks
|
|
Rachel Sibley |
bb681e |
|
|
Rachel Sibley |
bb681e |
Description:
|
|
Rachel Sibley |
bb681e |
|
|
Rachel Sibley |
bb681e |
Description of problem:
|
|
Rachel Sibley |
bb681e |
The readlink command fails with an error "Too many levels of symbolic links", even if there are only 2 levels.
|
|
Rachel Sibley |
bb681e |
|
|
Rachel Sibley |
bb681e |
The readlink command from RHEL 3 and RHEL 4 and from Fedora 11 all work fine.
|
|
Rachel Sibley |
bb681e |
|
|
Rachel Sibley |
bb681e |
Among other changes between RHEL 4 and RHEL 5, RHEL 5's coreutils added calls to cycle_check() in lib/canonicalize.c, but in upstream canonicalize.c (now in gnulib instead of coreutils), we see the comment:
|
|
Rachel Sibley |
bb681e |
/* Detect loops. We cannot use the cycle-check module here,
|
|
Rachel Sibley |
bb681e |
since it's actually possible to encounter the same symlink
|
|
Rachel Sibley |
bb681e |
more than once in a given traversal. However, encountering
|
|
Rachel Sibley |
bb681e |
the same symlink,NAME pair twice does indicate a loop. */
|
|
Rachel Sibley |
bb681e |
|
|
Rachel Sibley |
bb681e |
http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=lib/canonicalize.c;h=4f348398fd69ae516396313d18ac294a4ca3dde3;hb=b653eda3ac4864de205419d9f41eec267cb89eeb#l262
|
|
Rachel Sibley |
bb681e |
|
|
Rachel Sibley |
bb681e |
The latest canonicalize.c uses seen_triple() instead of cycle_check().
|
|
Rachel Sibley |
bb681e |
|
|
Rachel Sibley |
bb681e |
|
|
Rachel Sibley |
bb681e |
Version-Release number of selected component (if applicable):
|
|
Rachel Sibley |
bb681e |
coreutils-5.97-19.el5
|
|
Rachel Sibley |
bb681e |
|
|
Rachel Sibley |
bb681e |
How reproducible:
|
|
Rachel Sibley |
bb681e |
every time
|
|
Rachel Sibley |
bb681e |
|
|
Rachel Sibley |
bb681e |
Steps to Reproduce:
|
|
Rachel Sibley |
bb681e |
1. Create a directory with a symlink to itself
|
|
Rachel Sibley |
bb681e |
mkdir /tmp/dir
|
|
Rachel Sibley |
bb681e |
cd /tmp/dir
|
|
Rachel Sibley |
bb681e |
ln -s ../dir dirlink
|
|
Rachel Sibley |
bb681e |
|
|
Rachel Sibley |
bb681e |
2. Run readlink using the 'dirlink' symlink recursively
|
|
Rachel Sibley |
bb681e |
readlink -v -f dirlink
|
|
Rachel Sibley |
bb681e |
readlink -v -f dirlink/dirlink
|
|
Rachel Sibley |
bb681e |
readlink -v -f dirlink/dirlink/dirlink
|
|
Rachel Sibley |
bb681e |
|
|
Rachel Sibley |
bb681e |
Actual results:
|
|
Rachel Sibley |
bb681e |
The first readlink command on just dirlink succeeds, but the 2nd and 3rd commands fail with
|
|
Rachel Sibley |
bb681e |
readlink: dirlink/dirlink: Too many levels of symbolic links
|
|
Rachel Sibley |
bb681e |
|
|
Rachel Sibley |
bb681e |
Expected results:
|
|
Rachel Sibley |
bb681e |
$ readlink -v -f dirlink
|
|
Rachel Sibley |
bb681e |
/tmp/dir
|
|
Rachel Sibley |
bb681e |
$ readlink -v -f dirlink/dirlink
|
|
Rachel Sibley |
bb681e |
/tmp/dir
|
|
Rachel Sibley |
bb681e |
$ readlink -v -f dirlink/dirlink/dirlink
|
|
Rachel Sibley |
bb681e |
/tmp/dir
|
|
Rachel Sibley |
bb681e |
|
|
Rachel Sibley |
bb681e |
|
|
Rachel Sibley |
bb681e |
Additional info:
|