Bug 1206648 - Fedora-review (review-env.sh) breaking on exported Bash functions
Summary: Fedora-review (review-env.sh) breaking on exported Bash functions
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: fedora-review
Version: 21
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Stanislav Ochotnicky
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 1185565 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-03-27 15:58 UTC by Lars Kellogg-Stedman
Modified: 2015-04-16 09:17 UTC (History)
6 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2015-04-15 13:39:57 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Lars Kellogg-Stedman 2015-03-27 15:58:32 UTC

Comment 1 Lars Kellogg-Stedman 2015-03-27 16:07:49 UTC
The fedora-review tool generates a script named "review-env.sh" that starts with the following:

    unset $(env | sed -n 's/=.*//p')

This generates warnings when there are exported bash functions in the environment:

    $ env
    [...]
    BASH_FUNC_scl()=() {  local CMD=$1;
     if [ "$CMD" = "load" -o "$CMD" = "unload" ]; then
     eval "module $@";
     else
     /usr/bin/scl "$@";
     fi
    }

Which results in:

    WARNING: Illegal return from /usr/share/fedora-review/scripts/generic-excludearch.sh, code 82, output: stdout:None stderr:./review-env.sh: line 7: unset: `BASH_FUNC_module()': not a valid identifier
    ./review-env.sh: line 7: unset: `BASH_FUNC_scl()': not a valid identifier
    ./review-env.sh: line 7: unset: `[': not a valid identifier
    ./review-env.sh: line 7: unset: `"$CMD"': not a valid identifier

If this script wants to start with a clean environment, it should
consider something like:

    #!/bin/sh

    if ! [ "$CLEAN_ENVIRONMENT=1" ]; then
      exec env -i CLEAN_ENVIRONMENT=1 $0
    fi

Or just filtering out bash functions:

    unset $(env | grep '^[[:alpha:]]' | grep -v '()=()' | sed -n 's/=.*//p')

Comment 3 Alec Leamas 2015-04-15 13:47:37 UTC
*** Bug 1185565 has been marked as a duplicate of this bug. ***


Note You need to log in before you can comment on or make changes to this bug.