Bug 454212

Summary: -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 CFLAGS missing for fatsort
Product: [Fedora] Fedora Reporter: Mike <spambox>
Component: fatsortAssignee: Till Maas <opensource>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 8Keywords: Reopened
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: 0.9.8.2-2.fc8 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-07-14 12:09:52 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Mike 2008-07-06 19:30:28 UTC
Description of problem:
fatsort crash with error

 Version-Release number of selected component (if applicable):
fatsort-0.9.8.2-1.fc8

 How reproducible:
fatsort -f /dev/sdb1

 Actual results:
writeClusterChain: Seek error!
sortClusterChain: Failed to write cluster chain!
sortClusterChain: Failed to sort cluster chain!
sort_fs: Failed to sort cluster chain!
main: Failed to sort file system!

 Additional info:
'fsck.vfat /dev/sdb1' passess without any error.
There is no autofs/hald/messagebus.
Device is mounted by fstab line:
LABEL=MP3-1234   /home/mike/usb2  auto
rw,nosuid,nodev,noexec,noauto,user,uid=mike,gid=mike,umask=0077

When I get fatsort-0.9.8.2.tar.gz source and build it locally fatsort works fine.
Strange it is, because according to fatsort.spec there are no patches nor any
additional options for build.

Without '-f' flag there is additional error (not important for me):
 check_mounted: Unable to get realpath!
 sort_fs: Could not check if filesystem is mounted!
 main: Failed to sort file system!

Similar problem in ubuntu:
https://bugs.launchpad.net/ubuntu/+source/fatsort/+bug/128517

Comment 1 Till Maas 2008-07-06 20:04:22 UTC
Can you please run:
rpm --verify fatsort

If the output is empty, maybe it helps when you provide a backtrace:

1) debuginfo-install fatsort
2) # gdb fatsort
3) (gdb) run -f /dev/sdb1
notice crash
4) (gdb) bt
Then post the output here, but before you do this, make sure, that it does not
contain any private information.

I notified upstream about this bug, but I was not able to reproduce it.


Comment 2 Mike 2008-07-06 22:05:02 UTC
Empty output from 'rpm --verify fatsort'


(gdb) run -f /dev/sdb1
Starting program: /usr/sbin/fatsort -f /dev/sdb1
FATSort Utility 0.9.8.2 by Boris Leidner <fatsort(at)formenos.de>

File system: FAT32.

Sorting directory /
Sorting directory /-The_Offspring_-_Rise_and_Fall_Rage_and_Grace_2008.4233795.TPB/
writeClusterChain: Seek error!
sortClusterChain: Failed to write cluster chain!
sortClusterChain: Failed to sort cluster chain!
sort_fs: Failed to sort cluster chain!
main: Failed to sort file system!

Program exited with code 0377.
(gdb) bt
No stack.
(gdb)


looks like a dead end :(

On Ubuntu forum someone said that it might be related to locales.

$ locale
LANG=
LC_CTYPE=pl_PL
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=

I'm working in above environment.


Comment 3 Mike 2008-07-06 22:29:09 UTC
I'm trying to narrow problem.

Rpm build from this file won't work - same problem:
5e36a0d45cb06f80bb9ac6c9034230f1  fatsort-0.9.8.2-1.fc8.src.rpm

line from build by 'make':
gcc -g -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -c fatsort.c -o fatsort.o

line from build by 'rpmbuild -bb fatsort.spec':
gcc -O2 -g -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -c
fatsort.c -o fatsort.o

This pendrive (mp3) is almost 4GB (without 40MB for firmware).


$ diff -u fatsort.spec-orig fatsort.spec
--- fatsort.spec-orig   2008-07-07 00:22:44.000000000 +0200
+++ fatsort.spec        2008-07-07 00:23:11.000000000 +0200
@@ -21,7 +21,7 @@


 %build
-make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_OPT_FLAGS"
+make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64" LDFLAGS="$RPM_OPT_FLAGS"


 %install


problem "solved", but I don't know about "proper" state, need confirmation from
upstream


btw, is there anything we can do about '-f'?
 check_mounted: Unable to get realpath!
 sort_fs: Could not check if filesystem is mounted!
 main: Failed to sort file system!


Comment 4 Till Maas 2008-07-06 23:02:57 UTC
Yeah, the backtrace was actually not a good idea, because fatsort did not really
crash but exited cleanly. I located the bug, the CFLAGS get completely
overwritten when they are specified on the make commandline,
"-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" need to be set. I will push fixed
packages, soon.

About the "-f", I guess this is needed because you do not have an entry for
/dev/sdb1 in /etc/fstab, there is only one with the label. Therefore fatsort
cannot check, whether or not the filesytem is mounted. If you want it do beheave
differently, you need to talk to upstream.

Comment 5 Fedora Update System 2008-07-06 23:21:57 UTC
fatsort-0.9.8.2-2.fc9 has been submitted as an update for Fedora 9

Comment 6 Fedora Update System 2008-07-06 23:23:15 UTC
fatsort-0.9.8.2-2.fc8 has been submitted as an update for Fedora 8

Comment 7 Mike 2008-07-07 01:03:49 UTC
> About the "-f", I guess this is needed because you do not have an entry
> for /dev/sdb1 in /etc/fstab, there is only one with the label. Therefore
> fatsort cannot check, whether or not the filesytem is mounted. If you
> want it do beheave differently, you need to talk to upstream.

Changing 'LABEL=MP3-1234' to '/dev/sdb1' in fstab does not help.


Comment 9 Fedora Update System 2008-07-09 02:44:11 UTC
fatsort-0.9.8.2-2.fc8 has been pushed to the Fedora 8 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 10 Fedora Update System 2008-07-09 02:48:59 UTC
fatsort-0.9.8.2-2.fc9 has been pushed to the Fedora 9 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 11 Mike 2008-07-09 11:59:37 UTC
Upstream has fixed "check_mounted: Unable to get realpath!" bug:
https://developer.berlios.de/bugs/?func=detailbug&bug_id=14146&group_id=2731

Updated fatsort (fatsort-0.9.8.3):
https://developer.berlios.de/project/showfiles.php?group_id=2731
works fine no matter if I have 'LABEL=MP3-1234' or '/dev/sdb1' in fstab.

Please note, that mounted filesystem trigger a proper error.


Comment 12 Till Maas 2008-07-14 12:09:52 UTC
I will update fatsort soon. If you need a bug report for the realpath isssue,
please open a new bug report, but this one was only about the wrong CFLAGS.