Re: Re: Handling of shell builtins in make(1)

From: Harti Brandt (hartmut.brandt_at_dlr.de)
Date: 05/24/05

  • Next message: Sergey Babkin: "Re: Re: Re: Handling of shell builtins in make(1)"
    Date: Tue, 24 May 2005 14:19:17 +0200 (CEST)
    To: Sergey Babkin <babkin@verizon.net>
    
    

    On Tue, 24 May 2005, Sergey Babkin wrote:

    SB>>From: Harti Brandt <hartmut.brandt@dlr.de>
    SB>
    SB>>On Mon, 23 May 2005, Scott Long wrote:
    SB>>
    SB>
    SB>>SL>> Opinions?
    SB>>SL>>
    SB>>SL>> harti
    SB>>SL>
    SB>>SL>4. Separate /bin/sh into a front end and back end (libsh) and include libsh
    SB>>SL>into make.
    SB>>SL>
    SB>>SL>(running and hiding as I hit the 'send' key)
    SB>>
    SB>>Would there be other uses for this?
    SB>
    SB>Yes, I think it could be useful for many programs.

    Hmm. What program is executing shell lines?

    SB>Or one more option: add a flag to shell that
    SB>will make it exit after any command returning non-0
    SB>status (at the ";" point, as opposed to "&&",
    SB>"||" and such). Then make could just pass all
    SB>the commands to the shell in one go. And it would

    There is the -e flag which does exactly this. Well, the description in the
    Posix page is a little bit convoluted, but basically it exits when a
    program whose exit status is not expclicitely tested exits with a non-zero
    status (this is not entirely correct, but almost).

    And currently we actually use sh -ec to execute commands. The problem with
    this is, that Posix wants sh -c. No -e! I think NetBSD has changed this
    (and there is a PR with a patch), but I'm somewhat reluctant to do it,
    because it may break things in unexpected ways. My current plan is to make
    the default -e normally and without -e in Posix mode.

    SB>be very useful for all kinds of sysadmin scripts
    SB>as well where explicitly checking for the results
    SB>of every command is a pain. Even with make it
    SB>would be a big improvement, since in the current
    SB>format a command failing inside a "for" loop
    SB>won't cause make to stop unless explicitly programmed
    SB>so, like:
    SB>
    SB>target: dependencies
    SB> for ... ;\
    SB> do \
    SB> cmd || exit 1; \
    SB> done

    This is the canonical way to write this. Our make, however doesn't need
    it.

    harti
    _______________________________________________
    freebsd-arch@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-arch
    To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"


  • Next message: Sergey Babkin: "Re: Re: Re: Handling of shell builtins in make(1)"

    Relevant Pages

    • Re: Most dependable way to run system commands
      ... Eventually I'd like to bring the execution of a few system commands ... specific execution issue (it dealt more with executing Perl code)). ... Unix and many similar systems, the exit status is an integer, with 0 ... variable after running a command via system or backticks. ...
      (perl.beginners)
    • Re: very slow cursor in CMD window w/Text editor?
      ... REM MS-DOS-based application, Windows runs COMMAND.COM. ... To run CMD.EXE, the Windows command prompt, ... The exit command is an internal command part of command.com or cmd.exe. ...
      (microsoft.public.windowsxp.general)
    • Re: difference between the -o and || conditionals.
      ... you are running a first "[" command with ... equal to the number whose string representation is in its third ... a non-0 exit status otherwise. ... the cat and grep commands are run and its (possibly ...
      (comp.unix.shell)
    • [SLE] Printing help needed
      ... I broke my printing somehow. ... renderer command line returned an unrecognized error code 255.", exit ... printing through Kprinter and directly, command line, etc.). ... error on renderer command line or PostScript error. ...
      (SuSE)
    • Re: [BUGFIX 2/2] gdth: bugfix for the Timer at exit crash
      ... I have more problems reported, with exit, and am just sending one more patch that puts ... What does a driver need to do if it needs a consistent shutdown retine? ... The alternative for GDTH would be to process the SCSI SYNCHRONIZE CACHE ... Why would we think that the controller does not support this command ...
      (Linux-Kernel)