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

  1. Ensure you have a Fedora system.
  2. Install the attr package: sudo dnf install attr.
  3. Create a test directory: mkdir ~/attr_test.

How to test

  1. Open a terminal.
  2. Navigate to the test directory: cd ~/attr_test.
  3. Create a sample file: echo "Test content" > sample.txt.
  4. Set an extended attribute on the sample file using the setfattr utility: setfattr -n user.comment -v "This is a test attribute" sample.txt.
  5. Query the extended attribute using the getfattr utility: getfattr -n user.comment sample.txt.
  6. Remove the extended attribute using the setfattr utility: setfattr -x user.comment sample.txt.
  7. Again, query the extended attribute using the getfattr utility: getfattr -n user.comment sample.txt.

Expected Results

  1. After setting the extended attribute, there should be no errors returned by the setfattr utility.
  2. The getfattr utility should successfully display the attribute value "This is a test attribute" after it has been set.
  3. After removing the extended attribute, there should be no errors returned by the setfattr utility.
  4. The subsequent getfattr command should not display the attribute value, and it should indicate that the attribute does not exist.

Optional

For additional testing depth:

  1. Test setting and querying multiple extended attributes on a single file.
  2. Test the attr utilities on different file types, such as directories, symbolic links, etc.
  3. Verify the behavior of copying files with extended attributes to see if attributes are retained.
  4. Test on different file systems to ensure compatibility.