From Fedora Project Wiki
Description
The attr package provides utilities to administer the extended attributes on filesystem objects. Extended attributes store metadata that isn't captured by traditional file attributes. This test case ensures that the attr utilities can successfully manage extended attributes of filesystem objects.
Setup
- Ensure you have a Fedora system.
- Install the
package:
attrsudo dnf install attr. - Create a test directory:
mkdir ~/attr_test.
How to test
- Open a terminal.
- Navigate to the test directory:
cd ~/attr_test. - Create a sample file:
echo "Test content" > sample.txt. - Set an extended attribute on the sample file using the
setfattrutility:setfattr -n user.comment -v "This is a test attribute" sample.txt. - Query the extended attribute using the
getfattrutility:getfattr -n user.comment sample.txt. - Remove the extended attribute using the
setfattrutility:setfattr -x user.comment sample.txt. - Again, query the extended attribute using the
getfattrutility:getfattr -n user.comment sample.txt.
Expected Results
- After setting the extended attribute, there should be no errors returned by the
setfattrutility. - The
getfattrutility should successfully display the attribute value "This is a test attribute" after it has been set. - After removing the extended attribute, there should be no errors returned by the
setfattrutility. - The subsequent
getfattrcommand should not display the attribute value, and it should indicate that the attribute does not exist.
Optional
For additional testing depth:
- Test setting and querying multiple extended attributes on a single file.
- Test the
attrutilities on different file types, such as directories, symbolic links, etc. - Verify the behavior of copying files with extended attributes to see if attributes are retained.
- Test on different file systems to ensure compatibility.
