Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Thu, 12 Apr 2012 19:45:13 -0700
From: Isaac Dunham <idunham@...abit.com>
To: musl@...ts.openwall.com
Subject: sed unmacro

On Thu, 12 Apr 2012 20:18:51 -0400
Rich Felker <dalias@...ifal.cx> wrote:

> On Thu, Apr 12, 2012 at 04:59:12PM -0700, Isaac Dunham wrote:

> > This is the only way to access BIOS calls from Linux; unfortunately,
> > using the BIOS is necessary for proper screen setup/resume on some
> > machines.  
> 
> This should really be fixed at the driver level (writing the correct
> driver code rather than calling out to potentially-buggy/dangerous
> BIOS code that might even contain trojans installed when another OS
> was running and flashed the BIOS secretly), but demanding that it be
> fixed is outside the scope/authority of musl... :(
In some cases, it may be beyond the realm of feasibility:
it seems that a number of hardware vendors are convinced that they need
their own (incompatible, of course!) VGA initialization process, so
doing it "correctly" on one laptop will get you nothing on another.
AtomBIOS does the opposite, but that's AMD only.
Unfortunately, we're stuck working with the hardware that we get, not
hardware done properly.
 
> > I also noticed that it's using __uid_t & __gid_t, which appear to be
> > replaced by uid_t & gid_t in musl.  It may be wrong/unportable to
> > depend on implementation-specific stuff (__*), but I've seen these
> > several times before (a LOT of stuff won't build without
> > modification).
 
> This is something I intend to stand firm on. Software using type names
> in the reserved namespace is absolutely broken, has no excuse for
> doing so, and needs to be fixed. Please file bug reports.
..
> If this problem is as widespread as you say, it may be worthwhile to
> write a utility that recursively runs sed on a source tree, fixing all
> instances, and generates a patch to send upstream...

Doesn't run recursively or generate a patch, but... 

sed -e 's/__\([ug]id_t\)/\1/g' \
 -e 's/__long_double_t/long\ double/g' \
 -e 's/__BEGIN_DECLS/#ifdef\ __cplusplus\nextern\ \"C\"\ {\n#endif/g' \
 -e 's/__END_DECLS/#ifdef\ __cplusplus\n}\n#endif/g' 

makes a number of changes that are commonly needed.

And in case of macros like __P() (from sys/compat.h):

sed -e 's/__PM\{,1\}T\{,1\}(\(.*\))/\1/g' \
 -e 's/__NTH(\(.*\))/\1/g' \
 -e 's/__STRING(\(.*\))/#\1/g' 

This part is not as foolsafe--it fails on more complicated stuff like 
__STRING(somestring); sin(x);

Powered by blists - more mailing lists

Your e-mail address:

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.