nerdexam
LPI

303-300 · Question #84

What happens when the command getfattr afile is run while the file afile has no extended attributes set?

The correct answer is C. No output is produced and getfattr exits with a value of 0. When getfattr runs on a file with no extended attributes, it finds nothing to report - and since that is a valid, non-error state, it simply exits silently with code 0 (success). The tool treats "no attributes" as an expected outcome, not a problem worth warning about. Why the…

Access Control

Question

What happens when the command getfattr afile is run while the file afile has no extended attributes set?

Options

  • Agetfattr prints a warning and exits with a values of 0.
  • Bgetfattr prints a warning and exits with a value of 1.
  • CNo output is produced and getfattr exits with a value of 0.
  • DNo outputs is produced and getfattr exits with a value of 1.

How the community answered

(51 responses)
  • A
    2% (1)
  • B
    2% (1)
  • C
    88% (45)
  • D
    8% (4)

Explanation

When getfattr runs on a file with no extended attributes, it finds nothing to report - and since that is a valid, non-error state, it simply exits silently with code 0 (success). The tool treats "no attributes" as an expected outcome, not a problem worth warning about.

Why the distractors are wrong:

  • A & B are wrong because getfattr does not print a warning when attributes are merely absent - warnings are reserved for actual errors (e.g., file not found, permission denied).
  • D is wrong because exit code 1 signals failure; a missing attribute set is not a failure, so the exit code remains 0.

Memory tip: Think of getfattr like ls on an empty directory - it runs cleanly and quietly with exit code 0, because "nothing here" is a perfectly valid answer, not an error.

Topics

#getfattr#extended attributes#exit codes#file attributes

Community Discussion

No community discussion yet for this question.

Full 303-300 Practice