Was trying to extract a totally legit copy of Skate 3 I downloaded today to play on my Steam Deck

  • elrik@lemmy.world
    link
    fedilink
    English
    arrow-up
    27
    ·
    4 months ago

    How does it verify the command is valid? Does it run what I enter?

    If so, just give it an infinite loop followed by some attempt at a tar command:

    while true; do :; done; tar -xyz
    
    • mlg@lemmy.world
      link
      fedilink
      English
      arrow-up
      26
      ·
      4 months ago

      Blue Team: “Okay everyone let’s make sure this is absolutely the correct input”

      Red Team: “Lmao lets try this 90mb list of bash command injection patterns”

    • lseif
      link
      fedilink
      arrow-up
      2
      ·
      4 months ago

      i assume its looking for exit code of 0

    • Faresh@lemmy.ml
      link
      fedilink
      English
      arrow-up
      2
      arrow-down
      1
      ·
      edit-2
      4 months ago

      This one, if by unix he also means modern linux systems. Nowadays you can simply use tar xf my-file.tar.whatever and it should work on most linux systems (it worked on every modern linux system I’ve tried and every compressed tar file I’ve tried). I don’t think it is hard to remember the xf part.

  • atx_aquarian@lemmy.world
    link
    fedilink
    arrow-up
    19
    ·
    4 months ago

    I hitched my horse to just what I consider the basics–zip and unzip–and that has made it easy for me. But I’ve been stuck on those.

    Extract anything:

    tar xf <archive_file>
    

    Create a tbz2 archive:

    tar cjf <archive_file.tbz2> <stuff to put in it>
    

    (And tossing in a -v is pretty universal, if that’s your thing.)

    Some day, instead of commenting on a reddit Lemmy post, I think I’ll Google how to tell it to use .xz.

    Ok, you know what? Today is finally that day. It’s just capital -J instead of lower-case -j! That’s easy enough to remember, I guess.

  • umbraroze@lemmy.world
    link
    fedilink
    arrow-up
    16
    ·
    4 months ago

    Actually this reminds me, what is the deal with tar command recommendations to use or not use dash? I know GNU tar accepts both (e.g.) tar xvf file.tar and tar -xvf file.tar, but at some points people were like “NO! Don’t use the dash! It’s going to maybe cause issues somewhere, who knows!” and I was like “OK”. Something to do with people up designing the Unix specs?

    • Ben@feddit.dk
      link
      fedilink
      arrow-up
      5
      ·
      4 months ago

      I didn’t even know the dash was optional. I guess you learn something new everyday.

      • MehBlah@lemmy.world
        link
        fedilink
        arrow-up
        2
        ·
        4 months ago

        I still use it though. Its how I learned it all those years ago and its ingrained as muscle memory when typing the command.

    • voxel
      link
      fedilink
      arrow-up
      2
      ·
      4 months ago

      idk if it’s optional why bother typing it

      • lseif
        link
        fedilink
        arrow-up
        9
        ·
        4 months ago

        personally, it is a little easier to read, especially in a script. and its more consistent with other commands

    • barsoap@lemm.ee
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      4 months ago

      POSIX. POSIX didn’t get designed but documented behaviour that was portable between different UNIX flavours and was then declared a standard.

      If you’re annoyed by it just consider the xvf in tar xvf to be a subcommand as pull is in git pull. Tar simply has a fancy subcommand syntax. At least it’s not dd.

    • lseif
      link
      fedilink
      arrow-up
      9
      ·
      4 months ago

      shouldnt there be a filename argument ?

      • Christer Enfors@lemm.ee
        link
        fedilink
        English
        arrow-up
        5
        ·
        4 months ago

        Yes. However, if you had skipped the -f, it would have been valid. Without the filename argument, it assumes it should extract from the tape drive (TAR = Tape ARchive). The tape device is probably something like /dev/rmt0, but you don’t need to specify that. Using the -f is technically an exception which means “instead of extracting from the tape like you’d normally do, pretend that this file is the tape device instead.”

        • barsoap@lemm.ee
          link
          fedilink
          arrow-up
          3
          ·
          edit-2
          4 months ago

          GNU tar, at least a modern one, that is the one that happens to come with my system, won’t try to read from /dev but stdin and then complain that it’s a terminal and refuse.

          Quoth POSIX on the f flag:

          Use the first file operand […] as the name of the archive instead of the system-dependent default.

          That is GNU is compliant, here, the default is system-dependent. f - is required to be stdin, though, so you can bunzip2 foo.tar.bz2 | tar xf - or such in a portable manner, don’t have to rely on tar having a z option (which is nonstandard) or it auto-detecting compression (even more nonstandard). What is not standard either is tar -x: Tar doesn’t take leading hyphens. Tar is one of those programs so old its command line syntax got standardised before command line syntax standards were established. OTOH it’s not nearly as bad as dd, you can interpret how tar does things in the same way as git pull: It’s a subcommand, not a flag.

          • tisktisk@monero.town
            link
            fedilink
            arrow-up
            1
            ·
            4 months ago

            “one of those programs so old its…syntax got standardized before command line syntax standards were established.” –This is wild to learn, but also confusing. How does tar not take leading hyphens, but I’ve only ever used it as such without error of any kind? Not even bragging I’ve been doing that for 10+ years too lol

            • barsoap@lemm.ee
              link
              fedilink
              arrow-up
              2
              ·
              edit-2
              4 months ago

              Hmm. Actually you prompted me to dig a bit deeper: tar goes all the back to Version 7 UNIX, 1979, but the command line syntax is shared with tap, included in Version 1, man page dated to 1971-11-03. Development of C started 1972. Might’ve been written in B, you’d have to unearth a source archive I bet it’s around somewhere. But anyway if you look through the other Version 1 commands a lot of them don’t take hyphen commands, ls does, e.g. rm doesn’t on account of only taking file names as arguments.

              dd is actually younger, Version 5, 1974, the syntax apparantly comes from IBM’s JCL.

              Admittedly, that’s all before my time.

              Both BSD and GNU tar take hyphens, I don’t really have any experience with anything else but a short stint with Solaris in the early 2000s (very emphatically before Sun got gobbled up by Oracle) and I don’t remember hyphens tripping me up. Much unlike killall. And I’m apparently not alone in that.

      • tisktisk@monero.town
        link
        fedilink
        arrow-up
        2
        ·
        4 months ago

        I definitely still killed us all, but at the same time how are you supposed to know any of the filenames if none are given from the comic? I guess my real answer is to ‘tar -xvf’ then hit tab with hopes of decent file completion functionality lol

        • lseif
          link
          fedilink
          arrow-up
          1
          ·
          4 months ago

          tar -czf $(ls | head -n1) if we dont trust globs

          or run find in /bin or something