Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am thinking about installing the player for http://wolfframalpha.com/ but they have a .sh that is pushing a Mbyte in size. While reading through the start of the script i came across a section using dd. this bothered me so Id like some help reading exactly what this bit of code is going to attempt to perform on my laptop:
What exactly have you downloaded? I put 'Wolfram Alpha Player' in to Google and the first hit takes me to something which is 577MB
The function you post is using three arguments, so it should be useful to know what's being passed to it. Is this .sh all plain text? I've seen installers for stuff provided as .sh files but only small part at the start is plain text, the rest is binary stuff.
something to play with for my Computer Organization class. Just reading through and found the dd commands. i typically dont like dd commands being run if i dont know what they are writing over on my system.
ill try again, but dangz gedit is failing to open the file and the yank to clipboard commands for VI are not working as they are not overwritting what i have in there now:
ok, not going to happen. sorry if you need more of the code, please follow the link for the app from wolffram and download the .sh from there. after waiting well over an hour and having my laptop lock up due to gedit sucking up 100% of the CPU and RAM on a i5 with 8G ram i had to fight with the system to terminate gedit. file is just to large for the gui editor to access. if not, then ill just delete the .sh and not risk the install.
Well I can't say exactly what the dd does, but if you notice there's no "of" argument, so it's not actually writing to anything. From what I can tell it's just dumping a file to stdout.
Hi,
The dd man page implies that the dd commands running under "test" read from stdin and write to stdout. Given that the size of the shell script is 500+MB this is obviously a small shell script with a large binary attached to the end ( e.g cat <binary> >> <small shell script>). This is a standard trick for installing binaries ... e.g Virtualbox does this.
You can "see" the shell script by running "cat <big fat install package> | less". You will see the shell script part and as you scroll down, it will become obvious where the script ends and the binary begins. Typically the shell script allows you to specify options. The most useful is the "extract but do not install" option which will give you an opportunity to extract the binary and examine it (it may turn out to be a tar file) for "interesting" attributes!
Well I can't say exactly what the dd does, but if you notice there's no "of" argument, so it's not actually writing to anything. From what I can tell it's just dumping a file to stdout.
Yes, without 'of=' it's basic function would be similar to reading a file with 'cat' or 'less'. So in itself it's not writing over anything dangerous. Since it's inside a function, my understanding is it'll dump the results out for the caller of the function - so if you want to know where exactly the output ends up, you'd have to look for parts of the code that call the 'MD_dd' function. The first 'dd' command reads the input, and passes it to STDOUT, which in turn is directed to second block of code that has two more 'dd' commands. Those two will chop it up and pass it along to STDOUT again (which I believe then spits it out to caller of the function).
The first parameter ($1) is the name of the file or device it reads from. The second ($2) defines the size of the 'block' that it reads every cycle. conv=sync means it pads every input block with nulls to make it the size given by second parameter. The third parameter ($3) basically defines the total number of bytes it reads from the given input handle ($1).
The function will then 'chop' whatever it reads, into 1 kilobyte chunks, and spits those out to the caller of the function. Any remaining bytes that don't fill a full 1 kilobyte chunk are given out as the last chunk (which then might be smaller than 1 kilobyte).
Any possible error messages are silently discarded (directed to null device).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.