1168: "Tar"

This forum is for the individual discussion thread that goes with each new comic.

Moderators: Moderators General, Prelates, Magistrates

cream wobbly
Posts: 170
Joined: Mon Aug 03, 2009 3:07 pm UTC

Re: 1168: Tar

Postby cream wobbly » Fri Feb 01, 2013 7:16 pm UTC

Drooling Iguana wrote:~ $tar -zxf foo.tar.gz

How hard is that?

I know. Although I would've said tar xjf pr0n.tar.bz2

I wonder how many people think tar xkcd [...] is a valid command...
Spoiler:

Code: Select all

$ tar xkcd n00b.tar
tar: You may not specify more than one `-Acdtrux' option
Try `tar --help' or `tar --usage' for more information.


Edit: and there's your answer: tar --help is "A VALID tar COMMAND".

Lowercase now, no excuses.

cream wobbly
Posts: 170
Joined: Mon Aug 03, 2009 3:07 pm UTC

Re: 1168: Tar

Postby cream wobbly » Fri Feb 01, 2013 7:20 pm UTC

PolakoVoador wrote:
Kit. wrote:
PolakoVoador wrote:I find it odd that no one suggested tar --version

Code: Select all

...% tar --version
tar: s: unknown function modifier

From one of my Solaris boxes.


Well, BOOM. Sorry folks, I doomed us all :oops:

And sorry if someone mentioned tar --version prior to my post. I've read the entire thread and didn't notice any mention of it

That doesn't make it an invalid command.

aherstein
Posts: 1
Joined: Fri Feb 01, 2013 7:25 pm UTC

Re: 1168: Tar

Postby aherstein » Fri Feb 01, 2013 7:26 pm UTC

No Googling?

Code: Select all

man tar

colovelo
Posts: 5
Joined: Fri May 01, 2009 7:23 pm UTC

Re: 1168: Tar

Postby colovelo » Fri Feb 01, 2013 8:22 pm UTC

This comic and thread make me want to list XKCD on my resume. Just add it to the list of acronyms and see if anyone notices:

HTML, CSS, SVN, XKCD, XML, SQL

See, it just blends right in. :)

User avatar
Whizbang
The Best Reporter
Posts: 2238
Joined: Fri Apr 06, 2012 7:50 pm UTC
Location: New Hampshire, USA

Re: 1168: Tar

Postby Whizbang » Fri Feb 01, 2013 8:25 pm UTC

colovelo wrote:This comic and thread make me want to list XKCD on my resume. Just add it to the list of acronyms and see if anyone notices:

HTML, CSS, SVN, XKCD, XML, SQL

See, it just blends right in. :)


The bonus is that only an XKCD fan would get it, so you'd show a bit of your personality and form a bond with the hiring manager, giving you an edge.

Though, I suppose if they didn't get it and asked what it was, or Googled it, it might lead to questioning the accuracy of the entire resume... So, maybe not such a good risk.

mcdigman
Posts: 77
Joined: Fri Aug 17, 2012 6:32 pm UTC

Re: 1168: Tar

Postby mcdigman » Fri Feb 01, 2013 8:51 pm UTC

orthogon wrote:
mcdigman wrote:
orthogon wrote:I don't think we can assume it's a shell, even though it seems to have a prompt.
It would be easier to write a script, which calls tar with the arguments you supply. Or it's a special shell that does the same. Such a thing would have to be called the "bomb shell".


Well, if it takes everything after the word "tar" to be arguments, and determines whether it was a valid tar command by checking the exit code, then all we need is

Code: Select all

tar -xkcd | true

Hmm. We (the evil mastermind) might be looking at a serious amount of parsing to untaint the input. I thought of another couple of implementations on my journey home:
1. Rename the tar that came with the distro to tar.orig and make it executable by root only; make a new script called tar in the original place which calls tar.orig and explodes on failure and disarms on success. This way it detects tar being run from any window/shell/tty. Has same problem as the script (it's harder to get it to execute your pipeline but it can probably be done).
2. Recompile tar with the explode/disarm code added. This is better, I guess, since it really is tar being called and the pipes etc have been stripped by the OS before you even see them.
3. Rebuild the kernel to deal specially with exit code from tar.
4. Like 3 but by using something like inotify to get called whenever tar gets run.
In each case you can block or sabotage man, firefox, curl, wget or anything else that might be used to get help.


Then again, if you're an evil mastermind and your opponent is smart enough to envision and correctly execute an injection attack on their first try in under 10 seconds on an unfamiliar system, you probably want to recruit them, not blow them up.

qazwart
Posts: 6
Joined: Wed Nov 21, 2012 1:00 pm UTC

Re: 1168: Tar

Postby qazwart » Fri Feb 01, 2013 9:42 pm UTC

phlip wrote:
rwald wrote:I immediately thought "tar -xvf my_file_name.tar.gz"; I'm not seeing the challenge, here.

Well, if it's .tar.gz then you want to add a -z there, or you're going to blow us all up.

I know "tar xzvf whatever.tar.gz" and "tar xjvf whatever.tar.bz2", and in emergencies "tar cjvf whatever.tar.bz2 files"... I know there are other flags too, but I really couldn't bring myself to care. Why would I use, say, tar -t when I can just open it up in something like file-roller...


You guys haven't worked on Solaris. There's no "-z" flag there:

Code: Select all

$ tar cvf - * | gzip - > mytarball.tar.gz


Of course, I've may have just blown us all up.

jojo4u
Posts: 1
Joined: Fri Feb 01, 2013 9:40 pm UTC

Re: 1168: Tar

Postby jojo4u » Fri Feb 01, 2013 9:45 pm UTC

Ahh the perfect place for my experiment how different archivers cope with a) changed bytes b) deleted bytes. Tar did'nt fare well:

1. GNU tar 1.18:
a) doesn't matter
b) breaks at next file after error, you need tar-headers.pl or tarfixer

RISUKU
Posts: 1
Joined: Fri Feb 01, 2013 9:35 pm UTC

Re: 1168: Tar

Postby RISUKU » Fri Feb 01, 2013 9:54 pm UTC

For the uninitiated, those (like me) who do not know programming/coding, could someone explain this? Just what is 'tar' and what is supposedly so difficult/tricky about it? Or is it hard to explain unless one already know such stuff?

gnutrino
Posts: 100
Joined: Sat Sep 06, 2008 9:02 am UTC
Location: Over the edge...

Re: 1168: Tar

Postby gnutrino » Fri Feb 01, 2013 10:41 pm UTC

TimXCampbell wrote:Is this the first xkcd to identify somebody by name?

Rob? Short for Robert? Do we now have a name that's more conventional than that of the anti-hero “Black Hat Guy”?


Clearly his full name is Robert '); DROP TABLE Students;--

xtifr
Posts: 366
Joined: Wed Oct 01, 2008 6:38 pm UTC

Re: 1168: Tar

Postby xtifr » Fri Feb 01, 2013 11:54 pm UTC

villadelfia wrote:By the way, the shortest valid tar command is:

Code: Select all

tar x

Which reads a tarball from standard input. And unpacks is to the current working directory.


Correct on the shortest valid command. Incorrect on what it does. With traditional tar, this will try to extract from the tape device. With GNU tar, it will read from $TAPE, or if that's undefined, from standard input. Which may be a violation of the POSIX standards, but not one anyone in the world is likely to object to. Still, if you want your script to be portable, use "tar xf -" to extract from standard input if that's what you really want.

Klear wrote:I think winrar (and quite possibly almost every other modern compression software) has the option of creating "solid archive" which is exactly this.

Rar is simply a semi-proprietary variation of tar--or, more precisely, tar and rar are both derivatives of ar. (Nor is rar particularly "modern".)

In addition to the other problems with zip that EvanED mentioned, there's also the fact that it stores the "central directory" at the end of the file, which means it is all-but useless for streaming applications. Tar runs at the end of a pipeline, or even a socket, which makes it extremely flexible. That's why you can do things like "tar czf - foo | ssh user@remote tar xf -". Only the stream going across the pipe gets compressed, so there's no intermediate storage requirements on either end. You can back up a huge drive that way without having enough space on either end to store the compressed version. Try that with zip. (Even if there were sufficient free space on both ends, the tar version of transmittal is hugely faster, because the whole thing is streaming, and thus packing, compression, decompression and unpacking are all happening in parallel.)

Frankly, if I were forced to choose only one archive tool to keep around for the rest of my life, it would definitely be tar--though I have no objections if people use nice front ends (just as winrar is a nice front end to the crufty old rar format).
"[T]he author has followed the usual practice of contemporary books on graph theory, namely to use words that are similar but not identical to the terms used in other books on graph theory."
-- Donald Knuth, The Art of Computer Programming, Vol I, 3rd ed.

Kiersyn
Posts: 1
Joined: Fri Feb 01, 2013 11:38 pm UTC

Re: 1168: Tar

Postby Kiersyn » Fri Feb 01, 2013 11:59 pm UTC

It's a dual-trap comic. The obvious one for most people is of course finding the command to stop the bomb's countdown. Then you have people like me who are stuck agonizing over the poor grammar used in the exhortation. Seeing the usual precision blown over something that should be mundane is both odd and wryly amusing for someone who enjoys the strip's intelligent humor but does miss the more rarefied mathematical references on occasion.

Hypoon
Posts: 9
Joined: Wed Oct 27, 2010 5:25 am UTC

Re: 1168: Tar

Postby Hypoon » Sat Feb 02, 2013 12:07 am UTC

I'd use:

Code: Select all

tar c .

I wouldn't use standard input. The tar process would run continuously, rather than exiting successfully. I also wouldn't make up random filenames, since tar probably exits unsuccessfully if they don't exist. And I wouldn't dare try any command other than tar.

The only danger with my command is that you're making some assumptions about the working directory. It might still take too long to finish. Worse, there might be something unreadable in the directory. I'd be interested to know the shortest command that is GUARANTEED to exit successfully (and quickly), with minimal assumptions.

Code: Select all

tar c /dev/null

This almost works, but not all machines have /dev/null.

In a less serious situation, I might try a fork bomb if I think I'm looking at a real shell. Might cause enough lag to evacuate the area...

EDIT: Please ignore the contradictory context created by the phrases, "In a less serious situation" and "to evacuate the area"... I didn't think that through.

chronokitsune3233
Posts: 3
Joined: Sat Feb 02, 2013 4:02 am UTC

Re: 1168: Tar

Postby chronokitsune3233 » Sat Feb 02, 2013 4:19 am UTC

On any POSIX system that has at least one form of tar with the name "tar", the following should work:

Code: Select all

tar -c /bin/sh


On old systems, I'd wager that it would still work as long as tar exists because /bin/sh should exist on nearly all Unix and Unix-alike systems, old and new. Of course, depending on the implementation, the bomb could still go off if the tar command didn't exist (e.g. in C, system("tar -c /bin/sh") returns a non-zero value). Without a bit of time travel or an authoritative source, I'm guessing that the lack of a tar command would only be a problem on old systems where only cpio and/or ar were available.

User avatar
Icalasari
Posts: 107
Joined: Wed May 26, 2010 5:11 am UTC

Re: 1168: Tar

Postby Icalasari » Sat Feb 02, 2013 5:56 am UTC

My solution?

Use DuckDuckGo to search

User avatar
Klear
Posts: 1965
Joined: Sun Jun 13, 2010 8:43 am UTC
Location: Prague

Re: 1168: Tar

Postby Klear » Sat Feb 02, 2013 9:25 am UTC

Icalasari wrote:My solution?

Use DuckDuckGo to search


Awesome. And then, as the bomb begins to explode, you will realize that the bomb actually forbade you all search, despite mentioning only google, and that by being a smartass you doomed everyone. Thankfully you'll be annihilated moments later so you won't have to live with that knowledge for too long.

leifbk
Posts: 33
Joined: Wed Nov 26, 2008 7:24 am UTC
Location: Bærum, Norway
Contact:

Re: 1168: Tar

Postby leifbk » Sat Feb 02, 2013 9:37 am UTC

EvanED wrote:
mcdigman wrote:
syrinxsean wrote:
drbitboy wrote:an interesting correlation here would be age bins of the posters vs. percentage using a hyphen before the options.
Here's one data point: I'm 40 and I never use a hyphen before the options.


Data point 2: I'm 19 and-wait, they're optional?

Data point 3: a little under 30. I knew they're optional (probably added to make the command look more like most other utilities even though it still isn't) but do not use them.


I'm 60 and can't decide whether to use hyphens or not. Back in the 90s I mostly messed around with cpio, tapectl etc. on actual tape devices. I can't remember using tar before I set up my first Linux box in 2001.

(For a fun time look at the man page for ps.)


The GNU/Linux system has an eclectic mixture of System V and BSD syntax. A person coming from a System V culture (like me) will most likely type ps -ef to find out what's going on, while a BSD guy will type ps ax. Both work in the GNU ps.
Last edited by leifbk on Sat Feb 02, 2013 9:47 am UTC, edited 1 time in total.

User avatar
Arancaytar
Posts: 1642
Joined: Thu Mar 15, 2007 12:54 am UTC
Location: 52.44°N, 13.55°E
Contact:

Re: 1168: Tar

Postby Arancaytar » Sat Feb 02, 2013 9:39 am UTC

-c/-x: Create/extract an archive
-z/-j: (de)compress using the gz/bz2 schemes respectively (don't know what they're really called; looking up would be cheating)
-v: List files on stderr as they're added/extracted.
-f <file>: Read from or write to an archive file rather than stdio.

These are all I know, but you don't really need the rest. Though extracting a specific file or appending to archives might be useful on rare occasions. (Oh yeah, and I don't know which order is valid, but if the flags always follow the above order, there is no problem.)

It ain't exactly rocket science. :P (Hey, didn't Randall actually do rocket science?)
"You cannot dual-wield the sharks. One is enough." -Our DM.
Image

User avatar
Klear
Posts: 1965
Joined: Sun Jun 13, 2010 8:43 am UTC
Location: Prague

Re: 1168: Tar

Postby Klear » Sat Feb 02, 2013 10:06 am UTC

leifbk wrote:
EvanED wrote:
mcdigman wrote:
syrinxsean wrote:
drbitboy wrote:an interesting correlation here would be age bins of the posters vs. percentage using a hyphen before the options.
Here's one data point: I'm 40 and I never use a hyphen before the options.


Data point 2: I'm 19 and-wait, they're optional?

Data point 3: a little under 30. I knew they're optional (probably added to make the command look more like most other utilities even though it still isn't) but do not use them.


I'm 60 and can't decide whether to use hyphens or not. Back in the 90s I mostly messed around with cpio, tapectl etc. on actual tape devices. I can't remember using tar before I set up my first Linux box in 2001.


Data point 4: I'm 25. WTF is tar?!

chronokitsune3233
Posts: 3
Joined: Sat Feb 02, 2013 4:02 am UTC

Re: 1168: Tar

Postby chronokitsune3233 » Sat Feb 02, 2013 1:46 pm UTC

Arancaytar wrote:-z/-j: (de)compress using the gz/bz2 schemes respectively (don't know what they're really called; looking up would be cheating)

Sure, that may be all you need for your compression needs, but some people might need to work with Unix compress (.tar.Z or .taz; use the -Z option) or LZMA/XZ compression (.tar.lzma, .tar.xz; use the -J option; must have a "modern" version of GNU tar for the -J option (NeXTStep's won't work for example)).

Also, modern versions of GNU tar have a nice -a flag that works great based on the file extension used, so the compression scheme doesn't matter if GNU tar can read and write it.

I'm kinda old-school about things sometimes:

Code: Select all

tar -c file1 file2 fileN | gzip > files.tgz


Of course, if I was really old-school, I'd probably be using an antiquated find+cpio combination or the ar utility for the archiving. As for compression, apparently compress came about in the 1980s, but I wonder what else was widely available back then? compact? pack? I wonder if there are any old beards here. Come to think of it, I wonder if anybody here is still using telnet or SSH to dial into a BBS. I wonder too much, I think. :P

DR6
Posts: 171
Joined: Thu Nov 01, 2012 1:44 pm UTC

Re: 1168: Tar

Postby DR6 » Sat Feb 02, 2013 4:29 pm UTC

Varriount wrote:
Psykar wrote:Why do I know this stuff off the top of my head >.<

I don't know, but could you scrape some of it into my head? Reading 50+ line help printouts gives me a migraine.

I wish a pythonic variant of bash would come out, and act like I expect it to.

There's a python module called sh that lets you do:

Code: Select all

from sh import tar
flags,file="c",raw_input("Select a file")
tar(flags,file)

Kristopher
Posts: 10
Joined: Fri Sep 09, 2011 4:18 pm UTC

Re: 1168: Tar

Postby Kristopher » Sat Feb 02, 2013 4:40 pm UTC

Klear wrote:
Data point 4: I'm 25. WTF is tar?!


Sorry, if you don't have a pocket protector, grey hair and suspenders, you just die here.

tar stands for tape archive. It is how we used to store files that were not immediately needed, as well as archive entire program directories. If you were installing a new program, and not compiling it from c code, you usually got it in the form of a tarball. Later on they added the ability to use various forms of zip to compress the ball.

janhe
Posts: 3
Joined: Wed Jun 09, 2010 12:09 pm UTC

Re: 1168: Tar

Postby janhe » Sat Feb 02, 2013 9:47 pm UTC

I've used tar ofthen enough that I confidently would type in "tar -zxvf disarm.tar.gz", (and blow up everyone because I was blissfully unaware of the compatibility issues between different unix-like systems).
That shady utility called unrar on the other hand, I have to look up its man page every time I want to extract a rar archive.

wideyes
Posts: 4
Joined: Mon Jan 23, 2012 9:06 pm UTC

Re: 1168: Tar

Postby wideyes » Sun Feb 03, 2013 2:37 am UTC

This thread proves the sheer lack of humor sense present in some *nix users. Why read xkcd at all?

Varriount
Posts: 14
Joined: Sun Aug 12, 2012 8:14 am UTC

Re: 1168: Tar

Postby Varriount » Sun Feb 03, 2013 4:05 am UTC

wideyes wrote:This thread proves the sheer lack of humor sense present in some *nix users. Why read xkcd at all?

Humor? What is this "humor" you speak of? I thought the comics' purpose was to serve as an analytical exercise.

Anyway, maybe it's a good thing users of *nix don't have much in the way of humor. One wrong move while playing around in the shell, and you could blow up a sizeable portion of your neighborhood.

User avatar
Max™
Posts: 1792
Joined: Thu Jun 21, 2012 4:21 am UTC
Location: mu

Re: 1168: Tar

Postby Max™ » Sun Feb 03, 2013 6:55 am UTC

wideyes wrote:This thread proves the sheer lack of humor sense present in some *nix users. Why read xkcd at all?

Code: Select all

~$ humor
No command 'humor' found, did you mean:
 Command 'rumor' from package 'rumor' (universe)
humor: command not found
~$
mu

User avatar
orthogon
Posts: 3099
Joined: Thu May 17, 2012 7:52 am UTC
Location: The Airy 1830 ellipsoid

Re: 1168: Tar

Postby orthogon » Sun Feb 03, 2013 9:53 pm UTC

wideyes wrote:This thread proves the sheer lack of humor sense present in some *nix users. Why read xkcd at all?

The way I approach the forums is this: The comic portrays a ludicrously implausible and contrived situation, for humorous effect. In this context, the very act of making a post which purports to interpret the situation as worthy of serious analysis must itself be construed as an act of humour. The more detailed, profound, rigourous, solemn and insightful is the poster's argumentation, the more it subverts the assumption that the comic is just a bit of fun and therefore the more comedic potential it contains (up to a point).

Normally humour is thought to work the other way round: the sudden incongruity introduced between the audience's expectation and the reality is expected to debase or demean something. But it seems to me that a surprising elevation of the status of something is also used.

What I'm getting at is, and it's just my perception so apologies to anyone who is 100% deadly serious in everything they write, but: I assume that on a certain level most of us are ever so slightly taking the piss every time we post here.

On the other hand we might just be a bunch of misguided nerds trying to show off about how clever we are. That also works as a theory.
xtifr wrote:... and orthogon merely sounds undecided.

Psykar
Posts: 21
Joined: Mon Mar 23, 2009 4:32 am UTC

Re: 1168: Tar

Postby Psykar » Mon Feb 04, 2013 1:08 am UTC

syrinxsean wrote:
Psykar wrote:$ tar cvzf - <somefilenames> | ssh <remote> "tar xvzf - "

Of course this will simply untar in the home directory, it's nicer to actually do the command *from* the remote server


It's easier to just add the "cd" into the command:

$ tar cvzf - <somefilenames> | ssh <remote> "sh -c 'cd <where you want stuff>; tar xzf - '"
Fair call, but it's that bit of the syntax I can't remember - forgetting to put the cd command in a subshell gets me every time I try.

mcdigman
Posts: 77
Joined: Fri Aug 17, 2012 6:32 pm UTC

Re: 1168: Tar

Postby mcdigman » Mon Feb 04, 2013 1:34 am UTC

orthogon wrote:
wideyes wrote:This thread proves the sheer lack of humor sense present in some *nix users. Why read xkcd at all?

The way I approach the forums is this: The comic portrays a ludicrously implausible and contrived situation, for humorous effect. In this context, the very act of making a post which purports to interpret the situation as worthy of serious analysis must itself be construed as an act of humour. The more detailed, profound, rigourous, solemn and insightful is the poster's argumentation, the more it subverts the assumption that the comic is just a bit of fun and therefore the more comedic potential it contains (up to a point).

Normally humour is thought to work the other way round: the sudden incongruity introduced between the audience's expectation and the reality is expected to debase or demean something. But it seems to me that a surprising elevation of the status of something is also used.

What I'm getting at is, and it's just my perception so apologies to anyone who is 100% deadly serious in everything they write, but: I assume that on a certain level most of us are ever so slightly taking the piss every time we post here.

On the other hand we might just be a bunch of misguided nerds trying to show off about how clever we are. That also works as a theory.


lolz

eternaleye
Posts: 2
Joined: Fri Feb 01, 2013 9:49 am UTC

Re: 1168: Tar

Postby eternaleye » Mon Feb 04, 2013 4:06 am UTC

Another data point on the age question: I'm 22, and I use the hyphen if I remember and I'm not in a hurry. I find GNU style hyphenated options cleaner, but when I'm rushed I fall back to the habits I picked up when I decided to make Gentoo my first distro ever. And my only computer. At the age of 15. In September.

That was not a fun month.

On the other hand, I did get it running. Sink-or-swim tends to result in decent swimming skills for those that survive. Too bad about those start-of-school assignments...

gleitz
Posts: 1
Joined: Mon Feb 04, 2013 6:02 pm UTC

Re: 1168: Tar

Postby gleitz » Mon Feb 04, 2013 6:12 pm UTC

If you're like me you forget how to use tar all the time. To help with this problem there is a little program called Howdoi that gives you instant coding answers via the command line. For example, let's say you want to remember how to use `tar` but are a little too lazy for the man page. Just type:

Code: Select all

$ howdoi create tar archive

And it will give you the answer. For some reason I can't include the actual response because it marks this message as spam.

You can install Howdoi via pip with:

Code: Select all

pip install howdoi

Happy coding!

Skydiver
Posts: 6
Joined: Sat Jan 22, 2011 6:39 am UTC

Re: 1168: Tar

Postby Skydiver » Wed Feb 06, 2013 7:01 pm UTC

ycc1988 wrote:Is -xkcd a valid group of flags for any semi-well-known *n*x command?


Well yes, at least ls, but the output is not very exciting:

Code: Select all

$ ls -xkcd
.
$


Also wget, if it's compiled with the debug option:

Code: Select all

-c
--continue

-d
--debug

-k
--convert-links

-x
--force-directories

webgiant
Posts: 252
Joined: Mon Aug 17, 2009 5:36 pm UTC

Re: 1168: Tar

Postby webgiant » Fri Feb 08, 2013 4:28 am UTC

rwald wrote:I immediately thought "tar -xvf my_file_name.tar.gz"; I'm not seeing the challenge, here.

I'm not seeing a challenge either. Maybe the new crop of Unix users aren't using the CLI as much as we did.

User avatar
Max™
Posts: 1792
Joined: Thu Jun 21, 2012 4:21 am UTC
Location: mu

Re: 1168: Tar

Postby Max™ » Fri Feb 08, 2013 7:05 am UTC

webgiant wrote:
rwald wrote:I immediately thought "tar -xvf my_file_name.tar.gz"; I'm not seeing the challenge, here.

I'm not seeing a challenge either. Maybe the new crop of Unix users aren't using the CLI as much as we did.

A lot of us have gotten used to the external memory available of being able to google a command line input as well.

Oh, 32 (33? I forget, how old am I, how did I get here?) and my reflex is to use a hyphen.
mu

chronokitsune3233
Posts: 3
Joined: Sat Feb 02, 2013 4:02 am UTC

Re: 1168: Tar

Postby chronokitsune3233 » Fri Feb 08, 2013 9:37 am UTC

webgiant wrote:
rwald wrote:I immediately thought "tar -xvf my_file_name.tar.gz"; I'm not seeing the challenge, here.

I'm not seeing a challenge either. Maybe the new crop of Unix users aren't using the CLI as much as we did.

I took "valid" in the comic to mean "successful", so assuming that a certain tar file exists isn't possible. If you knew a file existed, sure, that would work, but for the case where you don't, you must instead create a tar archive because if the file doesn't exist, the result of the tar command will not be success, which means it wouldn't be valid, thus not disarming the bomb. The safest way to do it would be [tar -cf sh.tar /bin/sh]. If you don't care about the terminal output, you could let tar write to standard output instead of a file by using [tar -c /bin/sh] as I suggested earlier. However, when it comes to a bomb, I'd prefer to avoid screwing up my terminal to see if the bomb was successfully disarmed or not.

luolimao
Posts: 2
Joined: Fri Jul 17, 2009 8:15 am UTC

Re: 1168: Tar

Postby luolimao » Tue Feb 12, 2013 4:27 am UTC

chronokitsune3233 wrote:assuming that a certain tar file exists isn't possible.


Can't you just use `ls` to list the files and `file` to determine its type? But I guess with only 10 seconds, that's a bit wasteful. Also, I'm not sure whether "first try" means first command or first tar command. If I was stuck with that limit (and I'm taking "valid" to mean a return value of zero) I would probably just run `tar --help` or something inane like that. (By the way `tar -h` fails. :oops:)

Anyway, I never bother to to think about the -z or -j or -J flags. I've always ran `tar -xf foo.tar` or `tar -tf foo.tar` and it's worked so far, fortunately, and I use the -C flag when I'm writing scripts and such. I don't really have much use for any other flags... (which is weird, because I've never actually used -c, which one would expect some use out of) but I use those 4 flags often enough that I get them right.

On a slightly irrelevant note, here's a real challenge: try to use at least 20 unique non-alphanumeric characters to make a valid youtube comment (i.e. one that won't be rejected by their automatic filter). Hint - the filter is capricious and may decide to reject you for being you. Oh yeah, and you have 10 seconds and one try. :twisted:

User avatar
Max™
Posts: 1792
Joined: Thu Jun 21, 2012 4:21 am UTC
Location: mu

Re: 1168: Tar

Postby Max™ » Tue Feb 12, 2013 12:36 pm UTC

luolimao wrote:On a slightly irrelevant note, here's a real challenge: try to use at least 20 unique non-alphanumeric characters to make a valid youtube comment (i.e. one that won't be rejected by their automatic filter). Hint - the filter is capricious and may decide to reject you for being you. Oh yeah, and you have 10 seconds and one try. :twisted:

Spoiler:
Image


Oh rats, you said unique characters, I had "20 non-alphanumeric" in my head.
mu

morbit
Posts: 13
Joined: Wed Feb 13, 2013 4:15 pm UTC

Re: 1168: Tar

Postby morbit » Wed Feb 13, 2013 8:43 pm UTC

webgiant wrote:
rwald wrote:I immediately thought "tar -xvf my_file_name.tar.gz"; I'm not seeing the challenge, here.

I'm not seeing a challenge either. Maybe the new crop of Unix users aren't using the CLI as much as we did.


tar xf for me, same sentiment.

Russ Dobler
Posts: 8
Joined: Mon Feb 18, 2013 9:29 pm UTC

Re: 1168: Tar

Postby Russ Dobler » Mon Feb 18, 2013 11:54 pm UTC

I always feel lost on these programming ones. :/


Return to “Individual XKCD Comic Threads”

Who is online

Users browsing this forum: mscha and 43 guests