Giter VIP home page Giter VIP logo

Comments (6)

Mic92 avatar Mic92 commented on May 24, 2024

Maybe all those commands should just use lib.toGNUCommandLineShell for proper escaping.

from disko.

cscutcher avatar cscutcher commented on May 24, 2024

Oh man, how have I never come across toGNUCommandLineShell before! Nice!

Maybe all those commands should just use lib.toGNUCommandLineShell for proper escaping.

Yeah, I think that's a good call, given the amount of script generation going on. Although I think it'd still need special handling for the case of parted to ensure that quotes remain when parted parses the inner command (i.e. they're not all stripped by bash).

from disko.

cscutcher avatar cscutcher commented on May 24, 2024

I'm up for having a swing at this myself, but might be a while since not much free time to code at the moment.

from disko.

Lassulus avatar Lassulus commented on May 24, 2024

not sure if thats still a problem? maybe PRing an example which causes the break is enough so I can fix it

from disko.

cscutcher avatar cscutcher commented on May 24, 2024

Sorry, have been more busy than I expected this year!

As far as I can tell, it's still an issue as of 4eed245 . So generating diskoScript will result with something like;

parted -s /dev/disk/by-id/nvme-Samsung_SSD_970_PRO_1TB_SXXXXXXXXXXXXX -- mkpart Basic Data Partition ntfs 1049kB 473MB

when I believe the correct escaping (which I achieve with the escape_parted_name above) should be;

parted -s /dev/disk/by-id/nvme-Samsung_SSD_970_PRO_1TB_SXXXXXXXXXXXXX -- mkpart '"Basic Data Partition"' ntfs 1049kB 473MB

(slightly modified output to vaguely anonymise drive info)

Extracting from my config I think this should be enough to reproduce;

    disko.devices = {
      disk.root = {
        type = "disk";
        device = "/dev/sda1";
        content = {
          type = "table";
          format = "gpt";
          partitions = [
            {
              start = "1049kB";
              end = "473MB";
              name = "Basic Data Partition";
              fs-type = "ntfs";
              flags = [
                "hidden"
                "diag"
              ];
              content = {
                type = "filesystem";
                format = "ntfs";
                mountpoint = "/mnt/ignore/windows_recovery";
              };
            }
          ];
        };
      };
    };

will look at making an example PR when I can.

from disko.

cscutcher avatar cscutcher commented on May 24, 2024

Had a quick bash at reproducing with examples/test. I hadn't realised there was a new syntax for partition tables, but it seems to fail just the same (see PR).

Something that occurred to me while testing is that escaping the /dev/disk/by-partlabel isn't as simple as quoting, since it does the \x20 escaping thing (not sure how best to refer to it!);

$ ls /dev/disk/by-partlabel/Basic* 
'/dev/disk/by-partlabel/Basic\x20data\x20partition'

You might already have solved this problem elsewhere, but just in case it's helpful, I note that the systemd-escape command will escape spaces in the same way;

$ systemd-escape "Basic Data Partition"
Basic\x20Data\x20Partition

from disko.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.