Bug 200828 - fstyp(8) prints " " as the label of a labelless cd9660 filesystem
Summary: fstyp(8) prints " " as the label of a labelless cd9660 filesystem
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Many People
Assignee: Edward Tomasz Napierala
URL: https://reviews.freebsd.org/D2800
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-12 21:53 UTC by Alan Somers
Modified: 2016-06-23 15:33 UTC (History)
1 user (show)

See Also:
asomers: maintainer-feedback-
asomers: mfc-stable10+
asomers: mfc-stable9-
asomers: mfc-stable8-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alan Somers freebsd_committer freebsd_triage 2015-06-12 21:53:14 UTC
If you create a cd9660 filesystem with no label, makefs stores a string of 32 spaces in the volume's label field.  usr.sbin/fstyp/cd9660.c contains logic intended to truncate that label down to "" when printing the label.  However, there appears to be an off-by-one error.  fstyp will print " " as the label.

# mkdir dir
# mkdir dir/emptyfile
# makefs -t cd9660 -Z -s 64m cd9660.img dir
# fstyp -l cd9660.img | xxd
00000000: 6364 3936 3630 2020 0a                   cd9660  .
Comment 1 Edward Tomasz Napierala freebsd_committer freebsd_triage 2015-06-15 18:45:39 UTC
Could you test https://reviews.freebsd.org/D2830?
Comment 2 Alan Somers freebsd_committer freebsd_triage 2015-06-15 18:52:43 UTC
Isn't that exactly the same thing as https://reviews.freebsd.org/D2800 ?
Comment 3 Edward Tomasz Napierala freebsd_committer freebsd_triage 2015-06-15 19:05:09 UTC
No idea how did I manage to miss that one.  Still, stay tuned - there is a similar fix needed for msdosfs, and both need patching in geom_label(4).  Will submit an updated patch shortly.
Comment 4 commit-hook freebsd_committer freebsd_triage 2015-06-18 21:56:38 UTC
A commit references this bug:

Author: trasz
Date: Thu Jun 18 21:55:57 UTC 2015
New revision: 284582
URL: https://svnweb.freebsd.org/changeset/base/284582

Log:
  Fix off-by-one error in fstyp(8) and geom_label(4) that made them use
  a single space (" ") as a CD9660 label name when no label was present.
  Similar problem was also present in msdosfs label recognition.

  PR:		200828
  Differential Revision:	https://reviews.freebsd.org/D2830
  Reviewed by:	asomers@, emaste@
  MFC after:	2 weeks
  Sponsored by:	The FreeBSD Foundation

Changes:
  head/sys/geom/label/g_label.c
  head/sys/geom/label/g_label.h
  head/sys/geom/label/g_label_iso9660.c
  head/sys/geom/label/g_label_msdosfs.c
  head/usr.sbin/fstyp/cd9660.c
  head/usr.sbin/fstyp/fstyp.c
  head/usr.sbin/fstyp/fstyp.h
  head/usr.sbin/fstyp/msdosfs.c
Comment 5 Alan Somers freebsd_committer freebsd_triage 2016-06-23 15:33:11 UTC
Fixed by trasz in 284582