LX0-104 · Question #371
Which of the following statements is true when querying the extended attributes of a file that has no extended attributes set?
The correct answer is C. No output will be produced and getfattr will exit with a value of 0.. This question tests the behavior and exit status of the getfattr command when querying a file that has no extended attributes set.
Question
Options
- Agetfattr will print a warning and exit with a value of 0.
- Bgetfattr will print a warning and exit with a value of 1.
- CNo output will be produced and getfattr will exit with a value of 0.
- DNo output will be produced and getfattr will exit with a value of 1.
How the community answered
(29 responses)- B3% (1)
- C90% (26)
- D7% (2)
Why each option
This question tests the behavior and exit status of the `getfattr` command when querying a file that has no extended attributes set.
`getfattr` does not print a warning; it simply outputs nothing if no attributes are found, and it exits successfully.
`getfattr` does not print a warning and exits with a successful status of 0, not an error status of 1.
When `getfattr` is executed on a file that has no extended attributes set, the command correctly determines this state, produces no output as there are no attributes to display, and exits with a status code of 0 to indicate successful completion of the query.
`getfattr` exits with a successful status of 0, not an error status of 1, when no extended attributes are found.
Concept tested: getfattr behavior with no attributes
Source: https://linux.die.net/man/1/getfattr
Topics
Community Discussion
No community discussion yet for this question.