Page 1 of 2

/var/run/disk/by-serial Missing Last Character

PostPosted: Thu Feb 19, 2015 7:48 am
by ununnilium
In 1.3.1-RC5 the serial numbers for all of my drives (both Hitachi and Western Digital) are missing the last character in the /var/run/disk/by-serial directory generated by InvariantDisks. I'm not sure if this is a bug or a feature, but I would consider this a bug. I'm running OS X 10.8.5. Is this intended behavior?

Re: /var/run/disk/by-serial Missing Last Character

PostPosted: Thu Feb 19, 2015 7:50 am
by ilovezfs
It may be correct. Can you please share the output of ioreg -al

Re: /var/run/disk/by-serial Missing Last Character

PostPosted: Thu Feb 19, 2015 8:12 am
by ununnilium
Here's info for one of my drives. As you can see the last character is only missing from the InvarianDisks path.

Path Created by InvariantDisks:

/var/run/disk/by-serial/WDC_WD30EFRX-68EUZN-WD-WMC4N0H2JLJ

System Information App:

Capacity: 3 TB (3,000,592,982,016 bytes)
Model: WDC WD30EFRX-68EUZN0
Revision: 82.00A82
Serial Number: WD-WMC4N0H2JLJP
Native Command Queuing: Yes
Queue Depth: 32
Removable Media: Yes
Detachable Drive: No
BSD Name: disk1
Rotational Rate: 5400
Medium Type: Rotational
Partition Map Type: GPT (GUID Partition Table)
S.M.A.R.T. status: Verified

ioreg -la Listing:

<key>Device Characteristics</key>
<dict>
<key>Logical Block Size</key>
<integer>512</integer>
<key>Medium Type</key>
<string>Rotational</string>
<key>Physical Block Size</key>
<integer>4096</integer>
<key>Product Name</key>
<string>WDC WD30EFRX-68EUZN0 </string>
<key>Product Revision Level</key>
<string>82.00A82</string>
<key>Rotation Rate</key>
<integer>5400</integer>
<key>SATA Features</key>
<integer>14</integer>
<key>Serial Number</key>
<string> WD-WMC4N0H2JLJP</string>
</dict>

Re: /var/run/disk/by-serial Missing Last Character

PostPosted: Thu Feb 19, 2015 8:17 am
by ilovezfs
Interesting the 0 is also missing from WD30EFRX-68EUZN0

Re: /var/run/disk/by-serial Missing Last Character

PostPosted: Thu Feb 19, 2015 8:37 am
by ilovezfs
I think I found the bug if you want to try recompiling InvariantDisks:
https://github.com/cbreak-black/Invaria ... er.cpp#L56

I think that should be return s.substr(first, last - first + 1);

Re: /var/run/disk/by-serial Missing Last Character

PostPosted: Thu Feb 19, 2015 8:47 am
by ilovezfs
Yup.

Before:
Code: Select all
$ ./trimmer 'WDC_WD30EFRX-68EUZN0 '
trimmed: WDC_WD30EFRX-68EUZN
$ ./trimmer ' WD-WMC4N0H2JLJP'
trimmed: WD-WMC4N0H2JLJ

After:
Code: Select all
$ ./trimmer 'WDC_WD30EFRX-68EUZN0 '
trimmed: WDC_WD30EFRX-68EUZN0
$ ./trimmer ' WD-WMC4N0H2JLJP'
trimmed: WD-WMC4N0H2JLJP

Re: /var/run/disk/by-serial Missing Last Character

PostPosted: Thu Feb 19, 2015 9:01 am
by ilovezfs
OK, I have attached a patched version. Just replace the one in /usr/sbin.
InvariantDisks.zip
(91.07 KiB) Downloaded 1015 times

Re: /var/run/disk/by-serial Missing Last Character

PostPosted: Thu Feb 19, 2015 9:50 am
by ilovezfs

Re: /var/run/disk/by-serial Missing Last Character

PostPosted: Thu Feb 19, 2015 11:09 am
by ilovezfs

Re: /var/run/disk/by-serial Missing Last Character

PostPosted: Fri Feb 20, 2015 1:55 am
by ununnilium
That's great. Thanks for the quick fix! My Mac is busy uploading to an online backup provider right now, but when it's finished I'll try out the patched InvariantDisks.