All of lore.kernel.org
 help / color / mirror / Atom feed
* libblkid & empty identifier values
@ 2017-06-14 21:04 Pali Rohár
  2017-06-15  7:52 ` Karel Zak
  0 siblings, 1 reply; 3+ messages in thread
From: Pali Rohár @ 2017-06-14 21:04 UTC (permalink / raw)
  To: util-linux; +Cc: Karel Zak

[-- Attachment #1: Type: text/plain, Size: 716 bytes --]

Hello!

Technically UDF filesystem allows to store empty string values. 
LogicalVolumeIdentifier (label) according to UDF specification shall not 
be null, but it is possible to store empty string there.

Question is, what should libblkid's udf code do if e.g. LABEL identifier 
is empty string? Should it set empty LABEL for libblkid? Or it should 
not set LABEL at all?

Currently in blkid_probe_set_label() is check for len > 1, so empty 
string is not possible to store for LABEL. But when check fails function 
return non-negative value which is understood as succeeded -- even it 
did not store empty string. It does not looks good... Or it is expected?

-- 
Pali Rohár
pali.rohar@gmail.com

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: libblkid & empty identifier values
  2017-06-14 21:04 libblkid & empty identifier values Pali Rohár
@ 2017-06-15  7:52 ` Karel Zak
  2017-06-15  7:57   ` Pali Rohár
  0 siblings, 1 reply; 3+ messages in thread
From: Karel Zak @ 2017-06-15  7:52 UTC (permalink / raw)
  To: Pali Rohár; +Cc: util-linux

On Wed, Jun 14, 2017 at 11:04:34PM +0200, Pali Rohár wrote:
> Hello!
> 
> Technically UDF filesystem allows to store empty string values. 
> LogicalVolumeIdentifier (label) according to UDF specification shall not 
> be null, but it is possible to store empty string there.
> 
> Question is, what should libblkid's udf code do if e.g. LABEL identifier 
> is empty string? Should it set empty LABEL for libblkid? Or it should 
> not set LABEL at all?
> 
> Currently in blkid_probe_set_label() is check for len > 1, so empty 
> string is not possible to store for LABEL. But when check fails function 
> return non-negative value which is understood as succeeded -- even it 
> did not store empty string. It does not looks good... Or it is expected?

IMHO think it's expected, blkid_probe_set_label() hides all the logic
to keep probing functions simple. So, LABEL is optional and libblkid
should not return any error if FS does not define any LABEL.  The
empty string as label is unwanted and unexpected by library clients.

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: libblkid & empty identifier values
  2017-06-15  7:52 ` Karel Zak
@ 2017-06-15  7:57   ` Pali Rohár
  0 siblings, 0 replies; 3+ messages in thread
From: Pali Rohár @ 2017-06-15  7:57 UTC (permalink / raw)
  To: Karel Zak; +Cc: util-linux

On Thursday 15 June 2017 09:52:44 Karel Zak wrote:
> On Wed, Jun 14, 2017 at 11:04:34PM +0200, Pali Rohár wrote:
> > Hello!
> > 
> > Technically UDF filesystem allows to store empty string values. 
> > LogicalVolumeIdentifier (label) according to UDF specification shall not 
> > be null, but it is possible to store empty string there.
> > 
> > Question is, what should libblkid's udf code do if e.g. LABEL identifier 
> > is empty string? Should it set empty LABEL for libblkid? Or it should 
> > not set LABEL at all?
> > 
> > Currently in blkid_probe_set_label() is check for len > 1, so empty 
> > string is not possible to store for LABEL. But when check fails function 
> > return non-negative value which is understood as succeeded -- even it 
> > did not store empty string. It does not looks good... Or it is expected?
> 
> IMHO think it's expected, blkid_probe_set_label() hides all the logic
> to keep probing functions simple. So, LABEL is optional and libblkid
> should not return any error if FS does not define any LABEL.  The
> empty string as label is unwanted and unexpected by library clients.

Ok, in this case special logic for parsing empty UDF dstring identifiers
is not needed as they would be just ignored by libblkid (empty dstrings
are stored specially).

-- 
Pali Rohár
pali.rohar@gmail.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-06-15  7:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-14 21:04 libblkid & empty identifier values Pali Rohár
2017-06-15  7:52 ` Karel Zak
2017-06-15  7:57   ` Pali Rohár

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.