tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: ffsv2 extattr support



Hi,

me:
> > This 0-byte seems to be a bug-or-feature of setextattr(1).

Justin Cormack:
> This looks like a bug to me, attribute values need to be binary.

Probable cause is in getextattr.c line 314:

                        val_len = strlen(argv[0]) + 1;

with effect in line 338:
                                error = extattr_set_file(argv[arg_counter],
                                    attrnamespace, attrname, buf,
                                    val_len + flag_null);

I would do

-                       val_len = strlen(argv[0]) + 1;
-                       mkbuf(&buf, &buflen, val_len);
+                       val_len = strlen(argv[0]);
+                       mkbuf(&buf, &buflen, val_len + 1);

At least this helps here:

  $ cd /usr/src/usr.bin/extattr
  $ ln -s getextattr setextattr
  $ echo b > /mnt/ffs1/b
  $ ./setextattr user bla BBBBB /mnt/ffs1/b
  $ xorriso -for_backup -outdev stdio:/dev/null -map /mnt/ffs1/b /b -getfattr 
/b -- -rollback_end
  ...
  user.bla="BBBBB"

No zeros. No ambiguity. No visible problems with ./getextattr:

  $ ./getextattr -f user bla  /mnt/ffs1/*
  /mnt/ffs1/a     AAAAAAAAAAAAAAAA
  /mnt/ffs1/b     BBBBB
  /mnt/ffs1/x     xbla
  getextattr: /mnt/ffs1/xorriso_extracted: failed: No message available
  /mnt/ffs1/y     YYYbla


Have a nice day :)

Thomas



Home | Main Index | Thread Index | Old Index