Uploaded image for project: 'Erlang/OTP'
  1. Erlang/OTP
  2. ERL-343

disksup:get_disk_data() trims directory names after whitespace

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 19.1.1
    • Fix Version/s: 21.0
    • Component/s: os_mon
    • Labels:
      None

      Description

      Hello!

      When the mount point of a filesystem contains whitespace, the disksup:get_disk_data() returns only the characters before the whitespace, not the whole name. This is unexpected and could possibly make the string id's non-unique (e.g. if there's a filesystem mounted at "/Volumes/Install Google Drive" and an other mounted at "/Volumes/Install GitKraken", the return value will contain two tuples with "/Volumes/Install" as the first element). We've seen this problem both on Mac OS X (Sierra) and Linux (Debian stable). Example outputs on Linux:

      root@narmac:/tmp# /bin/df -lk
      Filesystem                  1K-blocks     Used Available Use% Mounted on
      udev                          4078640        0   4078640   0% /dev
      tmpfs                          817952     9228    808724   2% /run
      /dev/mapper/narmac--vg-root  25405772 13946000  10146188  58% /
      tmpfs                         4089760      136   4089624   1% /dev/shm
      tmpfs                            5120        4      5116   1% /run/lock
      tmpfs                         4089760        0   4089760   0% /sys/fs/cgroup
      /dev/sda1                      240972    62879    165652  28% /boot
      /dev/loop0                       8887       97      8278   2% /mnt/test with space
      

      and in the Erlang shell:

      1> application:start(sasl).
      ok
      2> application:start(os_mon).
      ok
      8> disksup:get_disk_data().  
      [{"/dev",4078640,0},
       {"/run",817952,2},
       {"/",25405772,58},
       {"/dev/shm",4089760,1},
       {"/run/lock",5120,1},
       {"/sys/fs/cgroup",4089760,0},
       {"/boot",240972,28},
       {"/mnt/test",8887,2}]
      

      The parsing in disksup:check_disks_* seems to be too simple.

        Activity

        Hide
        kvakvs Dmytro Lytovchenko added a comment -
        Show
        kvakvs Dmytro Lytovchenko added a comment - PR is posted here https://github.com/erlang/otp/pull/1502
        Hide
        nar NAR added a comment - - edited

        I've checked the PR and it worked for me on both on Debian Linux and OS X.

        Show
        nar NAR added a comment - - edited I've checked the PR and it worked for me on both on Debian Linux and OS X.

          People

          • Assignee:
            lukas Lukas Larsson
            Reporter:
            nar NAR
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development