I've found something that looks odd in the way v9fs
under Linux interacts with a fossil running on Plan 9.
If I create a file by redirecting output, the shell
seems able to happily create the file.  If I try to
cp a file, then it fails.  The logs show the error
"unknown mode."  As near as I can tell, here's what's
happening:

- cp creates the file with the O_EXCL flag.
- v9fs_uflags2mode() sets the P9_OEXCL flag.
- v9fs defines P9_OEXCL to be 4, where
  /sys/include/libc.h defines OEXCL to be 0x1000
- fossil masks the mode it gets with 7,
  keeping the P9_OEXCL flag.
- When fossil checks for the allowed modes, it
  does so with strict equalities that don't
  include bit 2 (the P9_OEXCL flag).  So none
  of them match, and we get an unknown mode.

At first glance, it would appear that there are two
bugs.  v9fs shouldn't define P9_OEXCL to be 4,
but to be 0x1000.  Second the OMODE mask in
/sys/src/cmd/fossil/9p.c should be 3 and not 7
so that we are only looking at the read and
write flags when doing the comparisons.

Am I missing something here?  Is there a reason
these are what they are?  If they've been identified
and fixed already, I apologize for the noise.

BLS

Reply via email to