#171 Build fails when sed is BSD sed

v2_4_14
closed
None
4
2014-09-06
2014-07-22
No

Hello, I'm a developer with the MacPorts project trying to update our dar port to the latest version 2.4.14, but it fails to build on Mac OS X 10.5.8 as follows:

sed: illegal option -- r
usage: sed script [-Ealn] [-i extension] [file ...]
       sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]

Mac OS X uses BSD sed; the -r flag is a GNU sed extension. The equivalent flag in BSD sed is -E.

The problem seems to be this line in src/libdar/Makefile.am:

LIBDAR_MEDIUM_000=`grep LIBDAR_COMPILE_TIME_MEDIUM libdar.hpp | cut -f 2 -d "=" | cut -f 1 -d ';' | sed -r -e 's% %%g' -e 's%([^0-9]|^)([0-9]{1})([^0-9]|$$)%0\2%' -e 's%([^0-9]|^)([0-9]{2})([^0-9]|$$)%0\2%'`

Changing -r to -E in that line allows the build to succeed, but that would obviously break Linux and other systems using GNU sed, so perhaps you can use some autoconf magic to determine the correct flag to use.

Discussion

  • Denis Corbin

    Denis Corbin - 2014-07-24
    • status: unread --> open
    • assigned_to: Denis Corbin
    • Severity: 1 --> 4
     
  • Denis Corbin

    Denis Corbin - 2014-07-24

    Hy Ryan,

    Thanks for your feedback. Yes, I will add some autoconf magic to determine the correct flag to use with sed.

    Thanks,
    Denis.

     
  • Denis Corbin

    Denis Corbin - 2014-07-25

    please find attached a patch that keeps compilation working under Linux and which should simplify BSD port.

    By the way, on the BSD system I have access to, the -r option is supported with sed, while on my Linux system the -E option seems supported (!) while not documented...

    anyway, this patch should solve the problem, if you have a change to send me your feedback about it I'd appreciate :)

    Thanks!

     
  • Denis Corbin

    Denis Corbin - 2014-07-25
    • status: open --> pending
     
  • Denis Corbin

    Denis Corbin - 2014-07-29

    I forgot to tell, if you need it, I can provide you an tarball (2.4.15_RC) of dar source with this patch integrating

    Cheers,
    Denis.

     
  • Ryan Schmidt

    Ryan Schmidt - 2014-07-29

    It looks like the message

    +     AC_MSG_RESULT([BSD sed using -r option for regex])
    

    should instead be

    +     AC_MSG_RESULT([BSD sed using -E option for regex])
    
     
  • Ryan Schmidt

    Ryan Schmidt - 2014-07-29

    And in the message

    +    AC_MSG_RESULT([gnu sed using -r option for regex])
    

    you may want to capitalize "GNU"

    And in the message

    +     AC_MSG_ERROR([unknown swich to use with sed to support regex])
    

    "switch" is misspelled.

     
  • Denis Corbin

    Denis Corbin - 2014-07-29

    Sorry for this mistakes. I've also noted another error, there should not be any brackets in the if/then condition used with sed.

    I've tested with a faked sed command that does not accept -r option and it seems to work as expected now.

    Thanks for your feedback and again sorry for these mistakes. :)

     
  • Denis Corbin

    Denis Corbin - 2014-07-29
    • status: pending --> fixed
     
  • Denis Corbin

    Denis Corbin - 2014-09-06
    • status: fixed --> closed
     
  • Denis Corbin

    Denis Corbin - 2014-09-06

    this fix is part of release 2.4.15

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks