Fifth FAQ

for

Project 2 -- fork, exec, and wait

Q. Thank you for your reply. But is it Ok if I set umask 0 at the shell command line before creating file (like blank.jpg) using pico command on shell prompt. The other possibility you mentioned was using exec to use pico. But i think this wont be useful since the TA has to creat the file.

A. I don't understand why you would want to use pico to create blank.jpg. As I said in my last answer on this topic, pico is intended to be a text editor. On the other hand, for this assignment you are to create a blank image file called "blank.jpg". While pico could be used to create this file (because UNIX files are all just sequences of bytes), it isn't the right tool for the job. A much more appropriate tool for creating this file would be gimp.

If, however, you wanted to create a file using pico, you certainly could set your umask to 0 at the shell prompt, then run pico to create the file. But, would you want to? Consider these points:

First, for this assignment, when you copy the file to the /tmp directory, you want PicShare to "set the permissions on the picture to 'world readable' so that anyone on the machine can view the picture" (as stated in the assignment) but "the picture should still be writable only by the user" (again quoting the assignment). If you created blank.jpg using pico with your umask set to 0, then it will not only be world readable but also world writable and group writable. So, if you just copy files around in your code using calls to cp, you may wind up with the file being placed in the /tmp directory with too many permissions. (I say MAY, because what actually happens will depend on the umask of the process at the time PicShare is run. While cp will not give the copy of the file more permissions than the original, it may give it fewer, based on the umask of the process.)

Second, umask is intended for setting the default permissions for new files that are created. If you are just trying to create a single file, why would you reset your default permission values? This is like reprogramming the speed dial on your telephone to call a phone number that you only intend to call once. While it would work, it would be more straightforward to just call the number. Similarly, it would be more straightforward to just create the file then set its permissions using chmod.


Q. I've been having to jump through a lot of hoops to get my programs to work on the Sun machines. It's not a fact of my code is bad (though it does tend to have problems sometimes :) ), but rather that there are quite a few libraries missing from the sun machines (dir.h, and a few others, but that's the pressing one right now)... Now, I know this is not your or your TA's fault, but it's still making my group have to program around the compiler, which we really shouldn't have to do. I was wondering if there was any solution we could possibly come up with for this?

A. Well, dir.h is not part of either the POSIX or ANSI C standards, so you really shouldn't be using it for programs in this class.

If you can't find header files or libraries that are part of POSIX or ANSI C, please let me know.


Q. Is is ok to turn in the hardcopy for project2 tomorrow in class, or do I need to bring it by before 6 today? Also, how can I confirm the the electronic copy was sent? I don't know much about the mail on the sun systems.

A. The hard copy is always due within 24 (weekday) hours after the electronic copy, so you have until 6 pm on Tuesday (Oct. 23) to turn in the hard copy for project 2. Don't forget that my office has moved -- I am now in EL 128 -- so that is where you need to turn in your hard copy, unless you turn it in tomorrow in class.

As for the electronic copy, if you followed the directions given in the class web pages, you will have sent a copy to your cs email account as well as one to the TA. You can see if this went through by reading your email on the cs machines (using mutt, pine, mail, or whatever you like). If you got the mail, then at least you know that mutt sent out your message.

The other things to look for when reading your email on the cs machines are messages from "Mail Delivery Subsystem <MAILER-DAEMON>" with the subject "Returned mail: see transcript for details". If you get one of these, then a message you sent from a cs machine didn't go through. The body of the message will include the reason (e.g., unknown host -- maybe you typed "egdyeman@ou.eduu" by mistake) as well as the entire message that you sent.