hello again, I wanna learn the program of linux-command. Where can I get it ?, if it's *.RPM or *.SRPMS, how to extract it so I can see its files one by one. thx a lot ===== Linux Aremania __________________________________________________ Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo http://search.yahoo.com
On Mittwoch, 16. April 2003 15:58, Linux Aremania wrote:
I wanna learn the program of linux-command. Where can I get it ?, if it's *.RPM or *.SRPMS, how to extract it so I can see its files one by one.
Believe me: You don't really want that... ;-)
On my machine, I have over 3000 commands available:
% ls `echo $PATH | tr ':' ' '` | wc -l
3302
...and I really don't have everything installed.
If you want to see what files belong to an RPM, use "rpm -ql":
% rpm -ql fileutils
...but that doesn't get you anywhere.
I suggest you read some good books (one usually isn't enough) about Linux and
then start over with the host of online documentation available - all the
HOWTOs, the info pages and - for the most important commands - the man pages.
Don't worry. Rome wasn't built in a day. You don't need to know each and every
Linux command; some 20 to 30 will do nicely for starters. A good Linux book
will point out the most important ones, and from then on it's learning by
doing.
CU
--
Stefan Hundhammer
On Wed, 2003-04-16 at 15:58, Linux Aremania wrote:
hello again, I wanna learn the program of linux-command. Where can I get it ?, if it's *.RPM or *.SRPMS, how to extract it so I can see its files one by one.
The source is in the src.rpm, assuming you know which one just do rpm -ivh filename.src.rpm. That will give you a spec-file in /usr/src/packages/SPECS. Then do rpm -bb /usr/src/packages/SPECS/filename.spec which will unpack the source in /usr/src/packages/BUILD/ To find out which source rpm contains the source for a particular command, first do "rpm -qf /path/to/command", which will tell you the rpm name, then do "rpm -qi rpm name". That will get you a lot of info about the rpm, including which src.rpm it was built from. Happy hacking :)
On Wed, 2003-04-16 at 19:36, Anders Johansson wrote:
rpm -bb /usr/src/packages/SPECS/filename.spec
which will unpack the source in /usr/src/packages/BUILD/
ooops, typo. The command above should read rpm -bp /usr/src/packages/SPECS/filename.spec bb will compile the rpm, bp unpacks the source and applies any patches the packager has put in there
Hello List readers, I've got a problem, i need to kill a program i run by doing a fork and a exec. When i kill the program i do a 'kill(pid,SIGKILL);' then to prevent a zombie i waitpid for the return value : 'waitpid(pid,&status,WUNTRACED);' this should prevent a zombie from forming. However, on slow hardware (it seems timing related), a zombie still appears. Here are some other details of the problem : OS : Suse 7.3 Actual kill code : /* * Make very sure it has ended and get return value */ kill(prog->pid,SIGKILL); waitpid(prog->pid,&status,WUNTRACED); // | WNOHANG); It happens on slow hardware, it will probably happen on fast hardware too only the change of it happening is muuuucccchh smaller. Do i do something wrong with the kill or the waitpid ?? Grtz Dries Pruimboom -- <End of message>
On Mon, 28 Apr 2003 12:54:27 -0700
dries
Hello List readers,
I've got a problem, i need to kill a program i run by doing a fork and a exec. When i kill the program i do a 'kill(pid,SIGKILL);' then to prevent a zombie i waitpid for the return value : 'waitpid(pid,&status,WUNTRACED);' this should prevent a zombie from forming. However, on slow hardware (it seems timing related), a zombie still appears.
Here are some other details of the problem :
OS : Suse 7.3
Actual kill code :
/* * Make very sure it has ended and get return value */ kill(prog->pid,SIGKILL); waitpid(prog->pid,&status,WUNTRACED); // | WNOHANG);
It happens on slow hardware, it will probably happen on fast hardware too only the change of it happening is muuuucccchh smaller.
Do i do something wrong with the kill or the waitpid ?? I generally use wait(2) rather than waitpid, although waitpid(2) should be working. Did you check the return value from waitpid? It should return either the pid of the process killed or -1. Another way to handle this is to use a SIGCHILD signal handler. -- Jerry Feldman
Boston Linux and Unix user group http://www.blu.org PGP key id:C5061EA9 PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9
Jerry Feldman wrote :
| On Mon, 28 Apr 2003 12:54:27 -0700
|
| dries
On Tue, 29 Apr 2003, dries wrote:
Jerry Feldman wrote : | On Mon, 28 Apr 2003 12:54:27 -0700 | | dries
wrote: | > Hello List readers, | > ......... snip | > /* | > * Make very sure it has ended and get return value | > */ | > kill(prog->pid,SIGKILL); | > waitpid(prog->pid,&status,WUNTRACED); // | WNOHANG); | > ... snip| | I generally use wait(2) rather than waitpid, although waitpid(2) should | be working. Did you check the return value from waitpid? It should | return either the pid of the process killed or -1. | Another way to handle this is to use a SIGCHILD signal handler. Well, that's what i'm doing now, i use the signal(SIGCHLD,SIG_IGN); to prevent zombies, this works but i think there is something weird going on with the
Excuse my ignorance, but you cant mix signal(for SIGCHLD) and waitpid right?
On Tue, 29 Apr 2003 14:18:25 -0400 (PYT)
Raúl Gutiérrez Segalés
Excuse my ignorance, but you cant mix signal(for SIGCHLD) and waitpid right? Sure you can. If you have a signal handler, the child generates a signal to the parent. If you issue a waitpid(2), it should fail if that child is no longer running.
--
Jerry Feldman
Jerry Feldman wrote :
| On Tue, 29 Apr 2003 14:18:25 -0400 (PYT)
|
| Raúl Gutiérrez Segalés
On Thu, 01 May 2003 08:25:52 -0700
dries
es that's correct, this doesn't explain however why a kill-waitpid sequence fials ! does it.
It strikes me as a bit odd (to say the least) that the kill-waitpid sequence doesn't work, the man pages give no clue why this would result in a zombie. That is true. Both kill(2) and waitpid(2) are system calls. For some reason, you hit a bug in the kernel, or the child might have been doing something, like trying to take input from the terminal.
If you have a small test program that exhibits this problem, could you
send it to me. When things should work, but do not, there is generally
something else involved.
--
Jerry Feldman
Jerry Feldman wrote : | If you have a small test program that exhibits this problem, could you | send it to me. When things should work, but do not, there is generally | something else involved. Well, that's part of the problem, i can't get this faulty situation to occur on my own machine, i can only get it to appear on a slower (300 Mhz) PC. I think the problem has got something to do with task-swaps and timing since on the slower PC it happens regularly but not 100% of the time. Since the PC is slower it spends more time in the kill-waitpid sequence (these commands are right behind one another in my source), thus giving a higher change that a taskswap is performed in this timeframe. Beware that i am just guessing here !. But to shortly answer your question, no, i haven't been able to make a program that shows this behaviour on my PC. sorry about that. (the same program that fails on the slower machine passes on a faster machine. What is notable is that the waitpid is passed, it returns immediately so waitpid sees that the process is ended. Still a zombie appears. Hope this was of any help .. . . . Grtz Dries Pruimboom -- <End of message>
On Thu, 01 May 2003 15:38:48 -0700
dries
Jerry Feldman wrote :
| If you have a small test program that exhibits this problem, could you| send it to me. When things should work, but do not, there is generally| something else involved.
Well, that's part of the problem, i can't get this faulty situation to occur on my own machine, i can only get it to appear on a slower (300 Mhz) PC. I think the problem has got something to do with task-swaps and timing since on the slower PC it happens regularly but not 100% of the time. Since the PC is slower it spends more time in the kill-waitpid sequence (these commands are right behind one another in my source), thus giving a higher change that a taskswap is performed in this timeframe. Beware that i am just guessing here !.
But to shortly answer your question, no, i haven't been able to make a program that shows this behaviour on my PC. sorry about that. (the same program that fails on the slower machine passes on a faster machine.
What is notable is that the waitpid is passed, it returns immediately so waitpid sees that the process is ended. Still a zombie appears.
So, you are saying that waitpid returns -1.
Does the zombie remain until you log out?, or does it eventually
terminate itself?
Possibly it is waiting on a page fault or there was a missed signal.
I would still add a signal handler on SIGCHILD in the parent. For the
handler, simply put in a simple wait(2):
void HandleSigchild(int sig)
{
pid_t rv;
if (sig == SIGCHILD) {
rv = wait(NULL);
}
}
It won't hurt to add this. I normally use sigaction(2) to set up the
signal handlers, but you can also use the older signal(2) system call
also.
--
Jerry Feldman
participants (6)
-
Anders Johansson
-
dries
-
Jerry Feldman
-
Linux Aremania
-
Raúl Gutiérrez Segalés
-
Stefan Hundhammer