First Last Prev Next    No search results available      Search page      Enter new bug
Bug#: 118600
Alias:
Product:
Component:
Status: RESOLVED
Resolution: FIXED
Assigned To: Gentoo Sound Team <sound@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: Ed Catmur <ed@catmur.co.uk>
Add CC:
CC:
Remove selected CCs
URL:
Summary:
Status Whiteboard:
Keywords:

Filename Description Type Creator Created Size Actions
api_replace_largefile_dependent_types.patch api_replace_largefile_dependent_types.patch patch Ed Catmur 2006-10-05 15:31 0000 490 bytes Details | Diff
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 118600 depends on: Show dependency tree
Show dependency graph
Bug 118600 blocks:
Votes: 0    Show votes for this bug    Vote for this bug

Additional Comments: (this is where you put emerge --info)







View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   Opened: 2006-01-10 17:38 0000
audiofile-0.2.6 is built with largefile support.

This breaks on big-endian 32-bit architectures (PPC) because the API and ABI
conflict on the width of off_t; audiofile is built with _FILE_OFFSET_BITS = 64
so its off_t is 64-bit but esd (which links against audiofile) is built without
so its off_t is 32-bit. The result is that functions that return off_t have the
low 32 bits (the ones that matter) discarded. (This is why little-endian 32-bit
architectures (x86) are OK; they discard the high 32 bits of off_t values,
typically all zero.)

Quick fix: build audiofile without largefile on ppc and other big-endian 32-bit
architectures.

Better: make the exposed API of audiofile use a type with well-defined width.
Is this possible?

------- Comment #1 From Luca Barbato 2006-01-10 20:53:16 0000 -------
why esd shouldn't use off_t as uint64_t if largefile is set?

------- Comment #2 From Ed Catmur 2006-01-11 03:18:07 0000 -------
esd is built without largefile support; that's the problem. (Ditto with
anything else built against audiofile and without largefile support.)

Basically, off_t is not suitable for use in API because its width is not well
defined.

------- Comment #3 From Ed Catmur 2006-01-11 03:31:53 0000 -------
Also, there are other packages built against audiofile; these will also break.

Actually, this needs fixing on x86 as well as there are potential crashers in
the API; e.g. afSeekFrame takes an off_t as its last argument (frameoffset); on
x86 only 32 bits will be placed on the stack so the high 32 bits of frameoffset
will be taken from whatever is next on the stack.

------- Comment #4 From Ed Catmur 2006-01-11 04:30:45 0000 -------
Uh, I've found a website that discusses this problem:

http://ac-archive.sourceforge.net/largefile/index.html

It seems changing off_t to int64_t in the exposed audiofile headers will fix
the structure-mismatch and callframe-mismatch problems.

------- Comment #5 From Luca Barbato 2006-01-11 20:37:27 0000 -------
any upstream acknowledge of the issue?

------- Comment #6 From Ed Catmur 2006-01-11 21:05:18 0000 -------
Not much. http://blog.gmane.org/gmane.comp.audio.audiofile (third item)
indicates the audiofile maintainers at least accept the issue exists. Can't
find anything on the Gnome side of things, though. (There is plenty of stuff on
largefile problems, but I can't find any discussions specifically on
audiofile<->esd.)

I imagine relatively few distros compile audiofile with largefile -- Fedora
doesn't, I don't think Debian does; Mandrake does but they don't run on ppc so
they won't have hit this bug.

------- Comment #7 From Diego Pettenò 2006-10-04 23:51:29 0000 -------
As upstream seems pretty deadish, would you mind submitting a patch to change
off_t to int64_t ? Or I'll try to do that asap.

------- Comment #8 From Ed Catmur 2006-10-05 15:28:42 0000 -------
Note: test case is:

$ ESDBG=1 esdplay /usr/share/sounds/warning.wav
frames: 0 channels: 1 rate: 44100.000000 format: 401 width: 16

Frames should be 6880 or similar.

I've got a patch; I'm just finishing testing it now. Unfortunately I don't have
access to x86 or amd64 at the moment so someone else will have to test it
there.

------- Comment #9 From Ed Catmur 2006-10-05 15:31:02 0000 -------
Created an attachment (id=98889) [edit]
api_replace_largefile_dependent_types.patch

Suggested patch. I think we can get away with something this simple; all that
matters is that int64_t is of constant width and can always store an off_t.

------- Comment #10 From Stanislovas Mickus 2006-10-10 16:25:59 0000 -------
Yep it should go upstream. I was running circles around it, until i found the
problem. Confirmed on 32-bit ppc. 

------- Comment #11 From Joe Jezak 2007-02-08 02:20:38 0000 -------
Diego, I can confirm that this fixes the problem on ppc.  Would you be okay
with applying it?

------- Comment #12 From Joe Jezak 2007-02-21 04:06:57 0000 -------
InCVS.  Thanks!

First Last Prev Next    No search results available      Search page      Enter new bug