Netatalk / netatalk

Netatalk is a Free and Open Source AFP fileserver. A *NIX or BSD system running Netatalk is capable of serving many Macintosh clients simultaneously as an AppleShare file server.
https://netatalk.io
GNU General Public License v2.0
354 stars 87 forks source link

testsuite: files/dirs created with system calls on Alpine Linux have wrong permissions #1682

Closed rdmark closed 2 weeks ago

rdmark commented 3 weeks ago

In the Alpine based Docker container for the testsuite, these two spectest tier 2 tests are failing. Looks like a permissions issue... But odd that only these two are affected when other tests do similar actions.

FPMoveAndRename:test136: move and rename in a dir without .AppleDouble - FAILED
FPMoveAndRename:test137: move and rename open file in dir without .AppleDouble - FAILED
############## entering test136 ##############
[FPCreateFile] Create File SOFT Vol 256 did : 0x2 <t136 move, rename >
mkdir(/mnt/afpshare/t136 dir)
[FPMoveAndRename] Move and rename Vol: 256 did: 0x2 <t136 move, rename > ==> 0x2 <t136 dir/new file name>
header.dsi_code       -5019 AFPERR_PARAM   
MAC RESULT: -5014 AFPERR_MISC    
[FPGetFileDirParams] GetFileDirParams Vol 256 did : 0x2 <t136 dir>
[FPMoveAndRename] Move and rename Vol: 256 did: 0x2 <t136 move, rename > ==> 0x36 <new file name>
header.dsi_code       -5000 AFPERR_ACCESS  
[../test/testsuite/T2_FPMoveAndRename.c:53] FPMoveAndRename(Conn, vol, DIRDID_ROOT, dir, name, name2)
[FPDelete] FPDelete conn 96000020 Vol 256 did : 0x2 <t136 dir/new file name>
header.dsi_code       -5018 AFPERR_NOOBJ   
[../test/testsuite/T2_FPMoveAndRename.c:55] FPDelete(Conn, vol, DIRDID_ROOT, name1)
[FPDelete] FPDelete conn 96000020 Vol 256 did : 0x2 <t136 move, rename >
[../test/testsuite/T2_FPMoveAndRename.c:56] !FPDelete(Conn, vol, DIRDID_ROOT, name)
[FPDelete] FPDelete conn 96000020 Vol 256 did : 0x36 <>
FPMoveAndRename:test136: move and rename in a dir without .AppleDouble - FAILED
############## entering test137 ##############
[FPCreateFile] Create File SOFT Vol 256 did : 0x2 <t137 move, rename >
mkdir(/mnt/afpshare/t137 dir)
[FPOpenFork] Open Fork resource Vol 256 did : 0x2 <t137 move, rename > access 3
fork refnum ID 4
[FPMoveAndRename] Move and rename Vol: 256 did: 0x2 <t137 move, rename > ==> 0x2 <t137 dir/new file name>
header.dsi_code       -5019 AFPERR_PARAM   
MAC RESULT: -5014 AFPERR_MISC    
[FPGetFileDirParams] GetFileDirParams Vol 256 did : 0x2 <t137 dir>
[FPMoveAndRename] Move and rename Vol: 256 did: 0x2 <t137 move, rename > ==> 0x38 <new file name>
header.dsi_code       -5000 AFPERR_ACCESS  
[../test/testsuite/T2_FPMoveAndRename.c:113] FPMoveAndRename(Conn, vol, DIRDID_ROOT, dir, name, name2)
[FPCloseFork] Close Fork 4
[FPDelete] FPDelete conn 96000020 Vol 256 did : 0x2 <t137 dir/new file name>
header.dsi_code       -5018 AFPERR_NOOBJ   
[../test/testsuite/T2_FPMoveAndRename.c:117] FPDelete(Conn, vol, DIRDID_ROOT, name1)
[FPDelete] FPDelete conn 96000020 Vol 256 did : 0x2 <t137 move, rename >
[../test/testsuite/T2_FPMoveAndRename.c:118] !FPDelete(Conn, vol, DIRDID_ROOT, name)
[FPDelete] FPDelete conn 96000020 Vol 256 did : 0x38 <>
FPMoveAndRename:test137: move and rename open file in dir without .AppleDouble - FAILED
rdmark commented 3 weeks ago

Put these two tests in quarantine for now, to unblock the new container builder in GitHub CI. The tests are working fine locally on Debian...

rdmark commented 2 weeks ago

Confirmed that this reproduces on a regular Alpine OS too.

In addition, these tests are flagged as Not Tested, uniquely on Alpine. They pass on Debian.

FPDisconnectOldSession:test338: AFP 3.x disconnect old session - NOT TESTED
FPDisconnectOldSession:test339: AFP 3.x No auth disconnect old session - NOT TESTED
FPDisconnectOldSession:test370: AFP 3.x disconnect different user - NOT TESTED

Edit: These three had to do with making direct calls to the FPopenLoginExt() function. When applying the workaround, 338 and 370 are passing everywhere, while 339 is failing everywhere (including with netatalk 3.1.12). Putting the latter in the Exclude bucket.

rdmark commented 2 weeks ago

The ad to ea conversion test fails on Alpine but not Debian

[FPopenLoginExt] LoginExt Version: "AFP3.4" uam: "Cleartxt Passwrd" user: "atalk1"
[FPopenLoginExt] LoginExt Version: "AFP3.4" uam: "Cleartxt Passwrd" user: "atalk2"
[FPOpenVolFull] Open Vol test1 bitmap 21
############## entering test431 ##############
[FPEnumerate_ext2] Enumerate_ext2 Vol 512 did : 0x2 <>
[FPOpenFork] Open Fork resource Vol 512 did : 0x2 <t431> access 3
header.dsi_code       -5000 AFPERR_ACCESS  
    FAILED
[FPDelete] FPDelete conn b60ad020 Vol 512 did : 0x2 <t431>
[FPDelete] FPDelete conn b60ad020 Vol 512 did : 0x2 <.AppleDouble>
FPOpenFork:test431: check AppleDouble conversion from v2 to ea - FAILED
[FPCloseVol] Close Vol 512
[FPLogOut] Logout
[FPLogOut] Logout
rdmark commented 2 weeks ago

I figured out the root cause for at least 431... Turns out, glibc and musl have different default permissions for files created through C system calls. With glibc, group get r/w permissions while with musl group only gets r permissions.

rdmark commented 2 weeks ago

All tests are working on Alpine now without the Exclusion flag! The ones that were caught as regressions in 4.0 in https://github.com/Netatalk/netatalk/issues/1669 are also passing (on Debian too). So some of the recent improvements must have had an effect, although I'm honestly not sure what exactly did the trick. Which is a bit worrisome.