Skip to content

Main → Disk Log Information fails for SATA disks: sh: line 1: ataN[.:]: command not found (7.3.3, regression from #2763) #2785

Open

Description

@Comitorismer

Unraid 7.3.3. On the Main page, the Disk Log Information button for any SATA disk shows the colour legend and then sh: line 1: ata3[.:]: command not found, with no log lines. NVMe disks still work.

Cause: commit f7e1ba6 (#2761, backported to 7.3 in #2763) changed the disklog case in include/OpenTerminal.php to:

$exec = wait($name,"grep -P ".escapeshellarg($dev)." /var/log/syslog*");

When the generated /var/tmp/<disk>.run.sh runs, bash strips that quoting, so run_cmd receives the bare pattern sdb|ata3[.:]. run_cmd then rebuilds the command with implode(' ',$argv) and runs it with popen(), which goes through sh. That shell reads the | as a pipe. NVMe patterns contain no |, so they still work. Bash also expands the now-unquoted glob itself, so run_cmd's own glob, which orders rotated syslogs by modification time, no longer runs.

Fix (tested on 7.3.3): quote the pattern for both shells and leave the glob to run_cmd, as before the change:

$exec = wait($name,"grep -P ".escapeshellarg(escapeshellarg($dev))." ".escapeshellarg('/var/log/syslog*'));

Alternatively, harden run_cmd itself:

$cmd = popen(implode(' ',array_map('escapeshellarg',$argv)).' '.escapeshellarg($log),'r');

Both return the expected disk log lines. NVMe output is unchanged. OpenTerminal.php is the only caller of run_cmd under /usr/local/emhttp.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions