You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently update a project from v1.3.3 to v1.8.2 and it looks like file mode is not preserved when creating files using MemMapFs.
I'm trying to write a file with os.ModeSocket to a MemMapFs instance in a test. After writing the file, I can see that os.ModeSocket is not set. It looks like this is cause by this line which mutate perm at the top of MemMapFs.OpenFile:
This effectively zeroes out any perm bits that are not the chmodBits which make it impossible to create irregular files. It looks like the handling for preserving previous bits while only honoring chmodBits is already in MemMapFs.Chmod. So maybe a better approach is to not modify perm, set the mode as passed on creation, and then call Chmod if chmod is true?:
I recently update a project from
v1.3.3
tov1.8.2
and it looks like file mode is not preserved when creating files usingMemMapFs
.I'm trying to write a file with
os.ModeSocket
to aMemMapFs
instance in a test. After writing the file, I can see thatos.ModeSocket
is not set. It looks like this is cause by this line which mutateperm
at the top ofMemMapFs.OpenFile
:afero/memmap.go
Lines 223 to 224 in 45ef346
Which was changed here: b598fbb
This effectively zeroes out any
perm
bits that are not thechmodBits
which make it impossible to create irregular files. It looks like the handling for preserving previous bits while only honoring chmodBits is already inMemMapFs.Chmod
. So maybe a better approach is to not modifyperm
, set the mode as passed on creation, and then call Chmod if chmod is true?:The text was updated successfully, but these errors were encountered: