Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#24505 closed defect (fixed)

testdisk 6.11: cannot analyse GPT volumes (GPT: invalid header size)

Reported by: wickedguitar6@… Owned by: nerdling (Jeremy L)
Priority: Normal Milestone:
Component: ports Version: 1.8.2
Keywords: haspatch, endian Cc: nerdling (Jeremy L), ryandesign (Ryan Schmidt)
Port: testdisk

Description

testdisk-6.11 has a fault bigendian architecture detection in its configure file. Therefore if there is in the environment a "CFLAGS=-arch ...." argument, it assumes that the bigendian arch is universal (e.g. even if "CFLAGS=-arch i386"). This results in that the program cannot correctly analyse GPT volumes (fails with GPT: invalid header size).

I patched the configure file so that bigendian is true only if "-arch" contains "ppc" or "ppc64". I also patched the Portfile.

Sorry if the technical terms are not 100% correct.

Attachments (2)

Portfile-testdisk.diff (353 bytes) - added by wickedguitar6@… 10 years ago.
Patched Portfile
patch-configure.diff (479 bytes) - added by wickedguitar6@… 10 years ago.
Patched configure file

Download all attachments as: .zip

Change History (8)

Changed 10 years ago by wickedguitar6@…

Attachment: Portfile-testdisk.diff added

Patched Portfile

Changed 10 years ago by wickedguitar6@…

Attachment: patch-configure.diff added

Patched configure file

comment:1 Changed 10 years ago by nerdling (Jeremy L)

Keywords: haspatch added; testdisk bigendian gpt removed
Owner: changed from macports-tickets@… to snc@…
Status: newassigned

comment:2 Changed 10 years ago by nerdling (Jeremy L)

Resolution: fixed
Status: assignedclosed
Type: updatedefect

Committed in r66511.

comment:3 Changed 10 years ago by nerdling (Jeremy L)

and r66515.

comment:4 in reply to:  description ; Changed 10 years ago by ryandesign (Ryan Schmidt)

Cc: ryandesign@… added
Keywords: endian added
Port: testdisk added; testdisk-6.11 removed
Summary: testdisk-6.11 Reports wrong bigendian architecturetestdisk 6.11: cannot analyse GPT volumes (GPT: invalid header size)

Replying to wickedguitar6@…:

testdisk-6.11 has a fault bigendian architecture detection in its configure file. Therefore if there is in the environment a "CFLAGS=-arch ...." argument, it assumes that the bigendian arch is universal (e.g. even if "CFLAGS=-arch i386"). This results in that the program cannot correctly analyse GPT volumes (fails with GPT: invalid header size).

I patched the configure file so that bigendian is true only if "-arch" contains "ppc" or "ppc64". I also patched the Portfile.

The autoconf variable ac_cv_c_bigendian is not being set to the value "true" or "false" at this point in the configure script; it is being set to the value "universal", whatever that means to autoconf. This "feature" of autoconf has never made sense to me, and your fix for it concerns me in that I doubt the problems experienced are specific to testdisk; it seems logical to me that every software package using endian detection via autoconf would also be affected (at least in MacPorts, where we always supply -arch flags, even when building for a single architecture, which is the situation the developers of autoconf seem not to have anticipated). Would you be willing to bring this issue to the attention of the developers of autoconf yet again and work with them towards a solution? IMHO the solution is to delete the ability for autoconf to detect endianness, since that is not the business of a configuration script but the business of defines in the sourcefiles. That's obviously not a workable solution since so much software out there already uses this flawed autoconf capability, but the solution they've developed so far is clearly not workable either, and detecting and fixing the problem in each individual affected port is not an effective use of anybody's time.

comment:5 in reply to:  4 Changed 10 years ago by jmroot (Joshua Root)

Replying to ryandesign@…:

This "feature" of autoconf has never made sense to me, and your fix for it concerns me in that I doubt the problems experienced are specific to testdisk; it seems logical to me that every software package using endian detection via autoconf would also be affected

Huh? This is something that autoconf gets right, unlike the SIZEOF_FOO stuff. If you have ac_cv_c_bigendian=universal, you get something like this in config.h:

#if defined __BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
#endif

How is that "flawed"?

comment:6 Changed 10 years ago by ryandesign (Ryan Schmidt)

Well, a) if that's what it does, why does it need to check anything at all? Why can't it unconditionally insert that code, since it looks like it should be fine for all cases? and b) why does using that code cause testdisk to malfunction?

Note: See TracTickets for help on using tickets.