Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 409927 - app-misc/symlinks can't handle files >2GB
Summary: app-misc/symlinks can't handle files >2GB
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Shell Tools project
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2012-03-27 21:54 UTC by Holger Hoffstätte
Modified: 2012-03-28 12:20 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch to add 64-bit file offset awareness (symlinks-1.4.ebuild.patch,387 bytes, patch)
2012-03-27 21:58 UTC, Holger Hoffstätte
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Holger Hoffstätte 2012-03-27 21:54:37 UTC
symlinks uses lstat(2) to find dangling symlinks, but fails with EOVERFLOW when running on 32-bit (x86) and when the target file is >2GB.


Reproducible: Always

Steps to Reproduce:
1. emerge symlinks on 32-bit arch (x86)
2. create symlink to file >2GB
3. oopsie
Actual Results:  
holger>ll foo largefile 
lrwxrwxrwx 1 holger users    8 Mar 27 23:27 foo -> swapfile
-rw-r--r-- 1 holger users 2.0G Mar 27 23:25 largefile

holger>symlinks -r /tmp
dangling: /tmp/foo -> largefile
/tmp/largefile: Value too large for defined data type


Expected Results:  
No error
Comment 1 Holger Hoffstätte 2012-03-27 21:58:18 UTC
Created attachment 306909 [details, diff]
Patch to add 64-bit file offset awareness

This kills the bug.
Comment 2 Holger Hoffstätte 2012-03-27 22:06:20 UTC
(In reply to comment #0)
> lrwxrwxrwx 1 holger users    8 Mar 27 23:27 foo -> swapfile
> -rw-r--r-- 1 holger users 2.0G Mar 27 23:25 largefile

*sigh* in case anyone is wondering about this inconsistency ("swapfile" vs. "largefile") in target filenames: this was an error in manual editing to hide the real filenames. The bug is real and reproducible.
Comment 3 Justin Lecher (RETIRED) gentoo-dev 2012-03-28 10:09:10 UTC
+*symlinks-1.4-r1 (28 Mar 2012)
+
+  28 Mar 2012; Justin Lecher <jlec@gentoo.org> +symlinks-1.4-r1.ebuild:
+  Add lfs flags in order to handle largefiles, #409927; drop optimization flag
+  from upstream
+
Comment 4 Holger Hoffstätte 2012-03-28 11:42:37 UTC
The append-lfs-flags thing didn't work for me (yes, I rebuilt -r1):

root>symlinks -r / | grep dangling    
/swapfile: Value too large for defined data type

Any ideas why?
Comment 5 Holger Hoffstätte 2012-03-28 11:50:06 UTC
(In reply to comment #4)
> The append-lfs-flags thing didn't work for me (yes, I rebuilt -r1):
> 
> root>symlinks -r / | grep dangling    
> /swapfile: Value too large for defined data type
> 
> Any ideas why?

If I manually add the flags from append-lfs-flags() in http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/eclass/flag-o-matic.eclass?revision=1.169&view=markup to the original Makefile and rebuild, it works. The ebuild does not apply the flag.

holger>emerge --quiet-build=n symlinks
Calculating dependencies  ... done!
 
>>> Verifying ebuild manifests
 
>>> Emerging (1 of 1) app-misc/symlinks-1.4-r1
 * symlinks-1.4.tar.gz RMD160 SHA1 SHA256 size ;-) ...                                                                               [ ok ]
>>> Unpacking source...
>>> Unpacking symlinks-1.4.tar.gz to /var/tmp/portage/app-misc/symlinks-1.4-r1/work
>>> Source unpacked in /var/tmp/portage/app-misc/symlinks-1.4-r1/work
>>> Preparing source in /var/tmp/portage/app-misc/symlinks-1.4-r1/work/symlinks-1.4 ...
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/app-misc/symlinks-1.4-r1/work/symlinks-1.4 ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/app-misc/symlinks-1.4-r1/work/symlinks-1.4 ...
make -j4 CC=i686-pc-linux-gnu-gcc 'CFLAGS=-pipe -march=native -mfpmath=sse -msse4.2 -O2 -fomit-frame-pointer -Wl,-O1,--as-needed,-z,now' 
i686-pc-linux-gnu-gcc -Wall -Wstrict-prototypes  -pipe -march=native -mfpmath=sse -msse4.2 -O2 -fomit-frame-pointer -Wl,-O1,--as-needed,-z,now -o symlinks symlinks.c
>>> Source compiled.
>>> Test phase [not enabled]: app-misc/symlinks-1.4-r1
Comment 6 Holger Hoffstätte 2012-03-28 12:04:38 UTC
The reason is that append-lfs-flags appends to CPPFLAGS, not CFLAGS. So it miust be passed to make: emake CC=$(tc-getCC) CFLAGS="${CPPFLAGS} ${CFLAGS} ${LDFLAGS}"

This works.
Comment 7 Justin Lecher (RETIRED) gentoo-dev 2012-03-28 12:20:30 UTC
(In reply to comment #6)
> The reason is that append-lfs-flags appends to CPPFLAGS, not CFLAGS. So it
> miust be passed to make: emake CC=$(tc-getCC) CFLAGS="${CPPFLAGS} ${CFLAGS}
> ${LDFLAGS}"
> 
> This works.

Thanks for the tip, I should have looked more closely.