Comment 29 for bug 1977491

Revision history for this message
Mike Silva (mikesilva) wrote (last edit ): Re: Samba aborts when deleting a file and "fruit:resource = stream" is used

I have tested the following configurations that used to fail , with Jammy Proposed, and found the bug does not reproduce.

From macOS client
1) Fruit enabled, streams enabled, file with no Alternate Data Stream created/deleted = Pass
2) Fruit enabled, streams enabled, file with ADS created/deleted = Pass
3) Fruit disabled, streams enabled, file with ADS created/deleted = Pass

From Ubuntu Jammy client
1) Fruit enabled, streams enabled, no Alternate Data Stream created/deleted = Pass
2) Fruit enabled, streams enabled, file with ADS created/deleted = Pass
3) Fruit disabled, streams enabled, file with ADS created/deleted = Pass

From Windows 11 client
) Fruit enabled, streams enabled, no Alternate Data Stream created/deleted = Pass
2) Fruit enabled, streams enabled, file with ADS created/deleted = Pass
3) Fruit disabled, streams enabled, file with ADS created/deleted = Pass

For posterity, because ADS is such a niche hellscape with each client OS using them a bit differently, here are the means with which I tested in an appropriate manner to each client OS and with an eye to being able to script in regression testing.

macOS
------------
- mount your test share with smbclient
- use commandline touch or text editor of choice to create a test text file, without ADS, then delete it.

- use commandline touch text editor of choice to create test text file, then add an ADS
 - after flat text file created and saved to share from touch or editor, you need to add the ADS, this is done by using the xattr command, like so:
  1) First verify the saved file has no ADSes, with the command:
   ls -l ./
   If ls returns the filename without showing an @, there is no ADS.
  2) Now we will use xattr to write an ADS to the file:
   xattr -w TestADS 'BlahBlah' testtext.txt
  3) Verify the ads has been written with:
   ls -l ./
  4) Verify the contents of the ADS with:
   xattr - p TestADS testfile.txt
  5) Verify the output is the string you input to the ADS stream.
  6) Delete the test file with:
   rm ./*
- Alternatively, use a GUI based tool like TextEdit on the Mac to create and save a file. This will necessarily create and save the file with various ADSes macOS uses. ADSes with complex names and values. Or, which could include binary data.

Linux
-----
- mount your test share with mount.cifs, specifying the user_xattr option.
- use commandline touch or text editor of choice to create a test text file, without ADS, then delete it.

- use commandline touch text editor of choice to create test text file, with the intention of adding ADS. mount.cifs allows extended attributes of the type .user by default.
  1) First verify the saved file has no ADSes, with the command:
   getfattr -R ./
   no output means there are no ADSes.
  2) Now we will use setfattr to write an ADS to the file:
   sudo setfattr -n user.TestADS -v 'BlahBlah' testfilewADSes.txt
  3) Verify the ads has been written with:
   getfattr -R ./
   Which should result output showing the ADS user.TestADS
  4) Verify the contents of the ADS with:
   getfattr -n user.TestADS testfile.txt
  5) Verify the output is the string you input to the ADS stream.
   BlahBlah
  6) Delete the files with
   rm ./*

  Alternatively, you can verify that you've created a file from Linux with the required ADSes by using smbclient and the allinfo command.

  Likewise, you could try accessing or removing the file via mount.cifs or smbclient to reproduce the bug.

Windows
-------
- use commandline to create a test text file, without ADS
 1) In Windows Command Prompt or Powershell, mount your test share with net use and give it a drive letter.
 2) cd [drive letter of share]
 3) Now we will use the echo command to write out an empty text file, and an associated ADS file with containing the text "BlahBlah":
  echo > testwoADS.txt blahblah
 4) Verify the test file contains the text "BlahBlah":
  type testwoADS.txt
 5) Delete the test file with:
  del testwoADS.txt

- use commandline to create test text file, with ADS
 1) In Windows Command Prompt or Powershell, mount your test share with net use and give it a drive letter.
 2) cd [drive letter of share]
 3) Now we will use the echo command to write out an empty text file, and an associated ADS file with containing the text "BlahBlah":
  echo blahblah > testwADS.txt:TestADS
 4) Verify the ads has been written with:
  dir /r
 5) You should get output that indicating the file testAWDS.txt exist, and an associated testwADS.txt:TestADS:$DATA
 6) Verify testwADS.txt is empty with:
  type testwADS.txt
 7) Verify testwADS.txt:TestADS:$DATA contains the test string "BlahBlah" with:
  type testwADS.txt:TestADS:$DATA
 8) Delete both files with:
  del *

Final Notes:
- I did verify that deleting a file with ADS created on one type of OS, from another OS did result in associated ADSes being deleted along with the file.

- Obviously, these test cases are not exhaustive, nor did I test all boundary conditions. (e.g. I didn't test writing out very large binary data ADSes) But, depending on the capabilities of Samba's test harness, perhaps these can serve as a basis for creating more exhaustive cross platform regression testing.

- Robbie, as mentioned on my previous comment, owing to your excellent question, I think the bug title should be changed, because the real dependency was having vfs streams_xattr enabled.