At 10:30 AM -0400 9/23/05, Gene Heskett wrote: >On Thursday 22 September 2005 23:16, Chris Adams wrote: ... >>"#" seems to work as a comment because many of the sections of spec >>files are run through a shell or other scripting language that >>recognizes "#" as a comment; rpm passes the lines through untouched. >>If you have a line like: >> >># %define xyzzy 123 >> >>then the define takes place; rpm doesn't see "#" as a comment. >> >>The problem lines from the spec file in question: >> >>************************************************************************ >>%postun Mesa-libGLU -p /sbin/ldconfig >> >>##### xfs scripts #################################################### >># Work around a bug in the XFree86-xfs postun script, which results in >> the # special xfs user account being inadvertently removed, causing xfs >> to run as # the root user, and also resulting in xfs not being >> activated by chkconfig, # This trigger executes right after the >> XFree86-xfs postun script, and ensures # that the xfs user exists, and >> that the xfs initscript is properly chkconfig # activated >> (#118145,118818) >>%triggerpostun xfs -- XFree86-xfs >>************************************************************************ >> >>The spec file syntax says that the "-p <program>" arg to %postun means >>to run the script with <program> instead of /bin/sh. If you don't >>provide a script, the program is run with no input. This is great for >>something like (obviously useless example, but you get the idea): >> >>************************************************************************ >>%postun -p /usr/bin/perl >>$x = 1; >>print $x + 1, "\n"; >>************************************************************************ >> >>However, what happens in the xorg problem spec file above is that rpm >>takes everything up to the next spec file directive as the script (only >>if the following lines are empty does rpm treat it as "no script"). >>Since "#" is not a spec file comment, that means rpm thinks that the >>"##### xfs scripts" lines before the %triggerpostun is actually the >>%postun script for xorg-x11-Mesa-libGLU, and that it should be run >>through /sbin/ldconfig. Of course, ldconfig doesn't know what to do >>with it; that's where we get the error. > >Oh cute... > >Where is there a bible for writing spec files? Or, better yet, why >isn't rpm re-written so a # in char position 1 is always a comment >line? That seems like the sensible thing to do, but I'm but the >expert... It might be safer (and simpler to get done) to enhance rpmlint to warn of such things: places where just having an apparent comment changes what will happen (non-empty input will be sent to the comand instead of empty input); and "scripts" that don't use a recognized script interpreter, with some popular hacks specifically recognized as unsafe. I suppose I could add a RFE for rpmlint. ____________________________________________________________________ TonyN.:' <mailto:tonynelson@xxxxxxxxxxxxxxxxx> ' <http://www.georgeanelson.com/>