Comment 2 for bug 67583

Revision history for this message
Kees Cook (kees) wrote :

The resulting file permissions are correct, according to the manpage:

If none of [the letters ‘ugoa’] are given, the effect is as if ‘a’ were given, but bits that are set in the umask are not affected.

At first I thought the exit code of 1 was a mistake, but it's not either. From the source:

/* If true, diagnose surprises from naive misuses like "chmod -r file".
   POSIX allows diagnostics here, as portable code is supposed to use
   "chmod -- -r file". */
static bool diagnose_surprises;

Changing the testcase to "chmod -- -x testfile" makes the exit code and warning go away.