Modify

Opened 3 years ago

Closed 3 years ago

#17601 closed defect (fixed)

hardware detection layer: board_detect script has bad logic

Reported by: rabryn@… Owned by: developers
Priority: normal Milestone:
Component: base system Version: Trunk
Keywords: hardware detection layer Cc:

Description

The new /bin/board_detect script "executes" the scripts located in /etc/board.d like this:

[ -d "/etc/board.d/" -a ! -f "/etc/board.json" ] || {
        for a in `ls /etc/board.d/*`; do
                [ -x $a ] || continue;
                $(. $a)
        done
}

I could be wrong, but I believe the board.d scripts will only be executed if the board.d directory doesn't exist (which would be bad) or the /etc/board.json file exists. The || should be && which would execute the board.d scripts if the board.d directory exists and the board.json file doesn't exist.

Inside the for loop the executable flag is checked on each file. If it's not executable it is skipped, if it is executable, it is sourced. Is sourcing the proper operation here? Should we actually execute the script?

Attachments (0)

Change History (2)

comment:1 Changed 3 years ago by anonymous

Forget the last part... I was confused on what sourcing a file means vs. executing it. I didn't realize sourcing a file actually executes it in the current shell, I thought it simply modified the environment.

comment:2 Changed 3 years ago by blogic

  • Resolution set to fixed
  • Status changed from new to closed

fixed in [42220]

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.