PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > comp.unix.shell > the return value of a process
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.unix.shell Using and programming the Unix shell.

the return value of a process

Réponse
 
LinkBack Outils de la discussion
Vieux 21/12/2007, 08h07   #1
rakesh uv
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut the return value of a process

hi,
is there any way to find the exact meaning of message given
by a Unix command
for example
mv: cannot access hello.c

similarly is there any way to find the meaning of the
error number or message displayed
by compilers

Rakesh UV
  Réponse avec citation
Vieux 21/12/2007, 08h45   #2
Joachim Schmitz
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: the return value of a process

"rakesh uv" <uvrakesh@gmail.com> schrieb im Newsbeitrag
news:74fa2b10-9b33-4493-9352-72608f866351@x29g2000prg.googlegroups.com...
> hi,
> is there any way to find the exact meaning of message given
> by a Unix command
> for example
> mv: cannot access hello.c
>
> similarly is there any way to find the meaning of the
> error number or message displayed
> by compilers

These should be in the documentation for the command in question.
If not: bad luck, you'd need to look at the source code instead.

Bye, Jojo


  Réponse avec citation
Vieux 21/12/2007, 09h45   #3
Stephane Chazelas
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: the return value of a process

On Fri, 21 Dec 2007 00:07:58 -0800 (PST), rakesh uv wrote:
> hi,
> is there any way to find the exact meaning of message given
> by a Unix command
> for example
> mv: cannot access hello.c

[...]

Often error messages are converted from the error code returned
by a system call made by the command. It is not the case above
as the "standard error message" wouldn't have anything specific
like "hello.c" in it, but if the error message is not self
explanatory and if the documentation for you command is not
specific enough about the error messages, then you can sometimes
reverse engineer to understand what happens.

For instance, if you see:

$ ls /etc/motd/bar
/bin/ls: /etc/motd/bar: Not a directory

You can search what "Not a directory" is the message for. For
instance, if your shell is zsh, you can do:

$ zmodload zsh/system
$ {for e ($errnos) syserror -p$e: $e} |& grep -i 'not a dir'
ENOTDIR:Not a directory

That means that ls made a system call that returned with the
ENOTDIR error.

Now, if you think of what ls does, it retrieves file attributes,
so it must be doing a stat(2) system call.

Now, the stat(2) man page tels us:
ENOTDIR
A component of the path is not a directory.

That's a more useful message.

On Linux, you could do:

~$ strace -f ls /etc/motd/foo |& grep -i 'not a dir'
stat64("/etc/motd/foo", 0x805cd24) = -1 ENOTDIR (Not a directory)
write(2, ": Not a directory", 17: Not a directory) = 17

(the |& syntax is zsh/csh/tcsh specific)

That's a shorter way to now which error (ENOTDIR) to lookup in
which man page (stat64).

~$ man stat64 | sed '/ENOTDIR/,/^$/!d'
ENOTDIR
A component of the path is not a directory.

(other systems have commands equivalent to Linux' strace (truss,
tusc...)).

For compiler errors, look at the documentation for your compiler.

--
Stephane
  Réponse avec citation
Vieux 21/12/2007, 10h47   #4
rakesh uv
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: the return value of a process

On Dec 21, 2:45 pm, Stephane Chazelas <stephane_chaze...@yahoo.fr>
wrote:
> On Fri, 21 Dec 2007 00:07:58 -0800 (PST), rakesh uv wrote:
> > hi,
> > is there any way to find the exact meaning of message given
> > by a Unix command
> > for example
> > mv: cannot access hello.c

>
> [...]
>
> Often error messages are converted from the error code returned
> by a system call made by the command. It is not the case above
> as the "standard error message" wouldn't have anything specific
> like "hello.c" in it, but if the error message is not self
> explanatory and if the documentation for you command is not
> specific enough about the error messages, then you can sometimes
> reverse engineer to understand what happens.
>
> For instance, if you see:
>
> $ ls /etc/motd/bar
> /bin/ls: /etc/motd/bar: Not a directory
>
> You can search what "Not a directory" is the message for. For
> instance, if your shell is zsh, you can do:
>
> $ zmodload zsh/system
> $ {for e ($errnos) syserror -p$e: $e} |& grep -i 'not a dir'
> ENOTDIR:Not a directory
>
> That means that ls made a system call that returned with the
> ENOTDIR error.
>
> Now, if you think of what ls does, it retrieves file attributes,
> so it must be doing a stat(2) system call.
>
> Now, the stat(2) man page tels us:
> ENOTDIR
> A component of the path is not a directory.
>
> That's a more useful message.
>
> On Linux, you could do:
>
> ~$ strace -f ls /etc/motd/foo |& grep -i 'not a dir'
> stat64("/etc/motd/foo", 0x805cd24) = -1 ENOTDIR (Not a directory)
> write(2, ": Not a directory", 17: Not a directory) = 17
>
> (the |& syntax is zsh/csh/tcsh specific)
>
> That's a shorter way to now which error (ENOTDIR) to lookup in
> which man page (stat64).
>
> ~$ man stat64 | sed '/ENOTDIR/,/^$/!d'
> ENOTDIR
> A component of the path is not a directory.
>
> (other systems have commands equivalent to Linux' strace (truss,
> tusc...)).
>
> For compiler errors, look at the documentation for your compiler.
>
> --
> Stephane


Thanks stephane
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 05h37.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,11887 seconds with 12 queries