Execution



  • Got this in the error log today. It was not really helpful.

    exec[1742]: Clients have been summarily executed



  • Depends on the clients, really.



  • Ah, figured out why it's failing.

    Apparently all my config files have swapped from Unix line endings to Windows line endings. Not really sure how I managed to do that, but hey, at least it's an easy fix.



  • @Rhywden said:

    Depends on the clients, really.

    The pesky ones, hopefully.



  • When you instruct gdbserver to kill the debugged process, it prints:

    Killing all inferiors
    

    which is not really appropriate when taken out of context…



  • exec[4007]: Terminating clients with extreme prejudice

    Well that escalated quickly.



  • exec[666] I am here

    If you get that, run. Don't walk.



  • Would you prefer "killing all children" ?



  • Evil ideas thread is :twisted_rightwards_arrows: that way.



  • @CodeNinja said:

    Apparently all my config files have swapped from Unix line endings to Windows line endings. Not really sure how I managed to do that, but hey, at least it's an easy fix.

    But did you fix the reading of the config files or preserve the WTF by updating the line endings?



  • +5 points if the client execution process involves a double-tap protocol.



  • Wife reading over my shoulder. We both couldn't help laughing out loud (yes, real "LOL" event). Hard.



  • @powerlord said:

    Would you prefer "killing all children" ?

    True story (actually my code):

    [4.22:root@centos apps]# grep children */*.c -n | anonymize
    [...]
    application1/app1_subapp1.c:420: * @return the number of children that have terminated since the last call of this function
    application1/app1_subapp1.c:422:static int check_for_dead_children(void){
    application1/app1_subapp1.c:910://              inhouse_logger(LOG_DEBUG, "checking for dead children");
    application1/app1_subapp1.c:911:                check_for_dead_children();
    application1/app1_subapp1.c:989://      inhouse_logger(LOG_DEBUG, "checking for dead children");
    application1/app1_subapp1.c:990:        check_for_dead_children();
    application1/app1_subapp1.c:1002:/** @brief kill all the children we started
    application1/app1_subapp1.c:1005:static int kill_children(void){
    application1/app1_subapp1.c:2087://             inhouse_logger(LOG_DEBUG, "checking for dead children");
    application1/app1_subapp1.c:2088:               check_for_dead_children();
    application1/app1_subapp1.c:2093:       inhouse_logger(LOG_DEBUG, "Finishing up. Killing children...");
    application1/app1_subapp1.c:2094:       kill_children(); // for those that aren't dead yet
    application1/app1_subapp1.c:2097:       check_for_dead_children();
    




  • @PJH said:

    | anonymize

    Hmm...that looks like a useful little utility.



  • @boomzilla said:

    Hmm...that looks like a useful little utility.

    [4.22:root@centos apps]# cat /usr/local/bin/anonymize 
    #!/bin/bash
    
    sed -e "s/█████████████████/application1/g" | \
    sed -e "s/████████/app1_subapp1/g" | \
    sed -e "s/███████████████/app1_subapp2/g" | \
    sed -e "s/█████/inhouse_logger/g" | \
    cat
    


  • This post is deleted!


  • @boomzilla said:

    But did you fix the reading of the config files or preserve the WTF by updating the line endings?

    They don't pay me enough, and could not afford to pay me enough, to dig into the giant pile of fail that is the config file loading code.

    Besides, it's running on Linux, it's OK if it's a Unix file ending.


  • SockDev

    @PJH said:

    [4.22:root@centos apps]# cat /usr/local/bin/anonymize
    #!/bin/bash

    sed -e "s/█████████████████/application1/g" |
    sed -e "s/████████/app1_subapp1/g" |
    sed -e "s/███████████████/app1_subapp2/g" |
    sed -e "s/█████/inhouse_logger/g" |
    cat

    useless use of cat. you could just end with that last sed command and it would work just as well.

    actually you could rewrite as:

    #!/bin/bash
    
    sed -e "s/█████████████████/application1/g" \
        -e "s/████████/app1_subapp1/g" \
        -e "s/███████████████/app1_subapp2/g" \
        -e "s/█████/inhouse_logger/g"
    
    

    and get the same result with 4 fewer processes (also probably faster because the data doesn't have to be streamed through all 5 processes, that's slow!



  • Or as

    #!/bin/bash
    
    sed "
      s/█████████████████/application1/g;
      s/████████/app1_subapp1/g;
      s/███████████████/app1_subapp2/g;
      s/█████/inhouse_logger/g;
    "
    

    Or if you like it really fancy (and confusing)

    #!/usr/bin/sed -f
    
    s/█████████████████/application1/g;
    s/████████/app1_subapp1/g;
    s/███████████████/app1_subapp2/g;
    s/█████/inhouse_logger/g;
    

  • SockDev

    @mihi said:

    #!/usr/bin/sed -f

    s/█████████████████/application1/g;
    s/████████/app1_subapp1/g;
    s/███████████████/app1_subapp2/g;
    s/█████/inhouse_logger/g;

    I like that one. i forgot that SED could be invoked like that.

    will have to remember that.



  • @mihi said:

    Or if you like it really fancy (and confusing)

    Actually, to me, that's not quite as confusing, and actually useful to me because I use something similar for compilations at work, however I'll have to do a bit of reading to make sure I can deal with environment variables...

    [pjh@lenovo ~]$ cat /usr/local/bin/colorize         
    #!/bin/bash
    RED_BACK="\x1b[1;41m"
    YELLOW="\x1b[1;33m"
    YELLOW_BACK="\x1b[1;44m"
    CYAN="\x1b[1;36m"
    
    
    GREY="\x1b[1;30m"
    
    
    # http://digitalpbk.blogspot.com/2007/05/ansi-escape-sequences.html
    
    # 00 for normal display (or just 0)
    # 01 for bold on (or just 1)
    
    # 04 underline (or just 4)
    # 05 blink on (or just 5)
    # 07 reverse video on (or just 7)
    # 08 nondisplayed (invisible) (or just 8)
    
    # 30 black foreground
    # 31 red foreground
    # 32 green foreground
    # 33 yellow foreground
    # 34 blue foreground
    # 35 magenta foreground
    # 36 cyan foreground
    # 37 white foreground
    # 39 default foreground
    
    # 40 black background
    # 41 red background
    # 42 green background
    # 43 yellow background
    # 44 blue background
    # 45 magenta background
    # 46 cyan background
    # 47 white background
    # 49 default background
    RED="\x1b[31m"
    GREEN="\x1b[32m"
    
    RESET="\x1b[m"
    IGNORE="\x1b[01;30;40m" # grey on black
    INFO="\x1b[01;37m" # bright white on black
    WARN="\x1b[01;33;43m" # yellow on orange
    ERROR="\x1b[01;05;33;41m" # Flashing yellow on red
    
    sed -ue "s/^\+.*$/$GREEN&$RESET/g"| \
    sed -ue "s/^\-.*$/$RED&$RESET/g"| \
    sed -ue "s/Entering directory/$GREEN&$RESET/g"| \
    sed -ue "s/Leaving directory/$RED&$RESET/g"| \
    \
    sed -ue "s/^.*i686-pc-linux-gnu-g.*/$IGNORE&$RESET/g"| \
    sed -ue "s/^.*i686-pc-linux-gnu-ar .*/$IGNORE&$RESET/g"| \
    sed -ue "s/^checking .*/$IGNORE&$RESET/g"| \
    sed -ue "s/^stripped: .*/$IGNORE&$RESET/g"| \
    sed -ue "s/^\/bin\/sh .*/$IGNORE&$RESET/g"| \
    \
    sed -ue "s/ignoring #pragma GCC diagnostic/$INFO&$RESET/g"| \
    \
    sed -ue "s/\.\.\. no/$WARN&$RESET/g"| \
    sed -ue "s/\.\.\. yes/$INFO&$RESET/g"| \
    \
    sed -ue "s/unused variable/$WARN&$RESET/g" | \
    sed -ue "s/warning:.*$/$WARN&$RESET/g" | \
    sed -ue "s/^.*] Error [0-9].*(ignored)$/$WARN&$RESET/g" | \
    sed -ue "s/assignment from incompatible pointer type/$WARN&$RESET/g"| \
    sed -ue "s/^.*]undefined reference to \`.*'.*$/$ERROR&$RESET/g" | \
    sed -ue "s/passing argument [0-9].*$/$WARN&$RESET/g"| \
    sed -ue "s/may be used uninitialized/$WARN&$RESET/g"| \
    sed -ue "s/implicit declaration of function/$WARN&$RESET/g" | \
    sed -ue "s/^.*In function.*$/$WARN&$RESET/g" | \
    sed -ue "s/ \/usr[^ ]*/$WARN&$RESET/g" | \
    sed -ue "s/-I\/usr[^ ]*/$WARN&$RESET/g" | \
    sed -ue "s/-L\/usr[^ ]*/$WARN&$RESET/g" | \
    \
    sed -ue "s/error:/$ERROR&$RESET/g" | \
    sed -ue "s/Unrecognized identifier/$ERROR&$RESET/g" | \
    sed -ue "s/Parse Error/$ERROR&$RESET/g" | \
    sed -ue "s/^.*] Error [0-9] [^(].*$/$ERROR&$RESET/g"
    
    # sed -ue "s/warning:/$ERROR&$RESET/g" | \
    #sed -ue "s/^.*\]Error [0-9].*$/$RED_BACK$YELLOW&$RESET/g"
    [pjh@lenovo ~]$ 
    
    [pjh@lenovo ~]$ cat /usr/local/bin/colmake
    #!/bin/bash
    renice +19 $$
    dt=`whoami`-$PROJECT-`date +%Y%m%d-%H%M%S`
    dr=~/tmp/
    errors=$dr/$dt.stderr.log
    output=$dr/$dt.stdout.log
    all=$dr/$dt.both.log
    echo -e "pwd=`pwd`\nmake $@" >$errors
    echo -e "pwd=`pwd`\nmake $@" >$output
    echo -e "pwd=`pwd`\nmake $@" >$all
    ((nice -n 19 make $@ 2>&1 1>&3 | tee -a $errors) 3>&1 1>&2 | tee -a $output) 2>&1 | tee -a $all | colorize
    
    # make $@ 2>&1 | colorize
    exit $?
    [pjh@lenovo ~]$ 
    

    And use colmake instead of make for colorized output plus full logs for stdout, stderr and stdout+stderr . Yes, I know there are programs that can do that out there but couldnt find anything to to what I wanted at the time. Quite what that was at the time I can't remember now...


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.