Date:        Wed, 26 Aug 2020 08:13:52 -0400
    From:        Greg Wooledge <wool...@eeg.ccf.org>
    Message-ID:  <20200826121352.gn...@eeg.ccf.org>

  | The obvious guess is that it's to "prevent you from accidentally
  | overwriting a file".

That would be what one would normally assume, but Dale didn't
show what comes just before the open (this sys call trace is
from a different OS, so the format is different)

 28469  28469 xkbcomp  CALL  unlink(0x7f7fffffec7b)
 28469  28469 xkbcomp  NAMI  "/dev/stdout"
 28469  28469 xkbcomp  RET   unlink -1 errno 13 Permission denied
 28469  28469 xkbcomp  CALL  open(0x7f7fffffec7b,0xa01,0x1b6)
 28469  28469 xkbcomp  NAMI  "/dev/stdout"
 28469  28469 xkbcomp  RET   open -1 errno 17 File exists

If it was attempting to "prevent you from accidentally overwriting a file"
it is unlikely it would be unlinking it (or attempting to) first.

(0xa01 == O_EXCL|O_CREAT|O_WRONLY   0x1b6 == 0666).

If one were to execute xkbcomp as root (people, please don't)
then all of this would probably succeed, and replace /dev/stdout
with a regular file containing the xkbcomp output.

kre


Reply via email to