Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
backslash in volume name cause mess in the system
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
Dominique_71
Veteran
Veteran


Joined: 17 Aug 2005
Posts: 1649
Location: Switzerland (Romandie)

PostPosted: Fri Mar 08, 2019 1:50 am    Post subject: backslash in volume name cause mess in the system Reply with quote

I have an USB stick with a silly volume name, and it confuse the system:

Code:
# cat /proc/mounts
/dev/sdb1 /media/USB\134x20DISK vfat   ...


Code:
# mount
/dev/sdb1 on /media/USB\x20DISK type vfat   ...


Code:
# findmnt
└─/media/USB\x5cx20DISK      /dev/sdb1   vfat      ...


Code:
df -h
/dev/sdb1       7.3G   89M  7.2G   2% /media/USB\x20DISK


4 commands and 3 different mount points into /media.
Is this a know bug?

The actual mount point is unique and is /media/USB\x20DISK. If I understand right that issue, it imply than, in scripts, I cannot rely on findmnt or the /proc/mounts file, but must use commands like mount.

EDIT: I just took a look with fdisk:
Code:
# fdisk /dev/sdb1

Welcome to fdisk (util-linux 2.33.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/sdb1: 7.3 GiB, 7790985216 bytes, 15216768 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x73696420

Device      Boot      Start        End    Sectors   Size Id Type
/dev/sdb1p1      1936286752 6221126032 4284839281     2T 45 unknown
/dev/sdb1p2      1853169786 3723051230 1869881445 891.6G 65 Novell Netware 386
/dev/sdb1p3      1701978226 3336544981 1634566756 779.4G 20 unknown
/dev/sdb1p4      2885681152 2885734079      52928  25.9M  d unknown

Partition table entries are not in disk order.

So according to fdisk, that 7.3 Gib stick have 4 partitions, one of 25.9M which seam raisonnable, a second one of 779.4G which is already surprising, a third one of 891.6G, and the fourth of amazingly 2T. Its pure magic.

And I don't see the 7.3G partition reported by df.

I know I could change these partition and reformat that disk, but it is not mine. I think it is the original partitioning of that stick, an EMTEC 8. My main concern is that mount issue, and about the best practice I can have if I want to make scripts with that mess.
_________________
[[[ To any NSA and FBI agents reading that text: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
Back to top
View user's profile Send private message
russK
l33t
l33t


Joined: 27 Jun 2006
Posts: 630

PostPosted: Fri Mar 08, 2019 2:35 am    Post subject: Reply with quote

Dominique_71,

I believe this is not a bug, it is a feature in each case :D

Check 'man ascii', search for '5C':
Code:
... snip ...
       032   26    1A    SUB (substitute)            132   90    5A    Z
       033   27    1B    ESC (escape)                133   91    5B    [
       034   28    1C    FS  (file separator)        134   92    5C    \  '\\'
       035   29    1D    GS  (group separator)       135   93    5D    ]
       036   30    1E    RS  (record separator)      136   94    5E    ^


\134 is octal for '\'
x5C is hex for '\'

The string 'USB\x20DISK' is the "correct" string. Each tool shows you a correct version of the name. Pick the one you most prefer. :wink:

You may also find it interesting:
Code:
$ cd /media
$ ls -N | grep USB
USB\x20DISK
$ ls -b | grep USB
USB\\x20DISK


Did you mean to use 'fdisk /dev/sdb' or 'fdisk /dev/sdb1'?

HTH
Back to top
View user's profile Send private message
Dominique_71
Veteran
Veteran


Joined: 17 Aug 2005
Posts: 1649
Location: Switzerland (Romandie)

PostPosted: Fri Mar 08, 2019 4:55 am    Post subject: Reply with quote

russK wrote:
Dominique_71,

\134 is octal for '\'
x5C is hex for '\'

The string 'USB\x20DISK' is the "correct" string. Each tool shows you a correct version of the name. Pick the one you most prefer. :wink:

OK I get it. It's so simple when we know what this is. In my case, as the issue I get into a script is the '\', it will change nothing. And now, it is fixed.

russK wrote:
You may also find it interesting:
Code:
$ cd /media
$ ls -N | grep USB
USB\x20DISK
$ ls -b | grep USB
USB\\x20DISK

So, with 'ls -b', the escape is escaped. 8)

Quote:
Did you mean to use 'fdisk /dev/sdb' or 'fdisk /dev/sdb1'?

HTH

My mistake! :roll:

And thank you russK!
_________________
[[[ To any NSA and FBI agents reading that text: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum