delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-SWARE-Spam-Status: | No, hits=-0.7 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,T_TO_NO_BRKTS_FREEMAIL |
X-Spam-Check-By: | sourceware.org |
MIME-Version: | 1.0 |
In-Reply-To: | <32663265.post@talk.nabble.com> |
References: | <CAG_2cT=rmeJpmZbYDo7RAwjNcTTDSTH1SMhuzzL9qi09ZJwGyA AT mail DOT gmail DOT com> <32663265 DOT post AT talk DOT nabble DOT com> |
Date: | Sun, 16 Oct 2011 20:16:46 -0400 |
Message-ID: | <CAG_2cTn3km6ASEOK4rEGO=k6Kj=9RYpkRWL=2Beup2fi+hSp0A@mail.gmail.com> |
Subject: | Re: /proc/*/cmdline corrupted |
From: | Jon Clugston <jon DOT clugston AT gmail DOT com> |
To: | cygwin AT cygwin DOT com |
X-IsSubscribed: | yes |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
X-MIME-Autoconverted: | from quoted-printable to 8bit by delorie.com id p9H0HF3f014612 |
I've checked and on Linux (at least) xterm's command line is not corrupted. From looking at the xterm code, it would appear that the X libraries would have to be what is corrupting the command line. I didn't look into the X library (XmParseCommand). Jon On Sun, Oct 16, 2011 at 5:31 PM, jan.kolar <kolar AT math DOT cas DOT cz> wrote: > >> jc807j 2668 1 0 08:59 tty0 00:00:00 xterm -e ssh server > 80x72+285+0 -e ssh server >> jc807j 3004 1 0 08:59 tty0 00:00:00 xterm -e ssh server >> 80x72-8+0 -e ssh server >> jc807j 2928 5852 0 09:12 ? 00:00:00 xterm 20000 +tb > >> The actual command lines for the 3 xterm processes are: >> C:\cygwin\bin\xterm.exe -sl 20000 +tb -geometry 80x72+285+0 -e ssh server >> C:\cygwin\bin\xterm.exe -sl 20000 +tb -geometry 80x72-8+0 -e ssh server >> C:\cygwin\bin\xterm.exe -sl 20000 +tb > > xterm calls XrmParseCommand() that > "parses an (argc, argv) pair according to the specified option table ... and > modifies the (argc, argv) pair to remove all recognized options." > > Therefore > "-sl 20000 +tb -geometry 80x72+285+0" > is properly removed > and "-e ssh server" is moved to __argv[1 .. 3]. > Then __argv[4] (respectively __argv[1] for the shorter command) is assigned > null pointer > which results in the second "\0" in the od-output below. > > > HOWEVER: > > Either XrmParseCommand() does not update argc > or the change does not propagate (how would that be possible?) to __argc. > Therefore the command lines appear corrupted this particular way. > > > /proc/*/cmdline uses a copy of __argc named __argc_safe > which is hardly to be updated anyway. > " for (int i = 0; i < __argc_safe; i++) " > > Funny enough, /proc/self/cmdline is likely to contain shortened version of > cmdline: > " for (char **a = __argv; *a; a++) " > [ pinfo.cc from cygwin 1.7.9-1 ] > > > >> I have verified that the "/proc/*/cmdline" is the source of the >> corrupted information. "cmdline" from PID 2928 is: >> >> jc807j@~>od -c /proc/2928/cmdline >> 0000000 x t e r m \0 \0 2 0 0 0 0 \0 + t b >> 0000020 \0 >> 0000021 > > > > > > > ---- > What does xterm on different platforms ? > While concept of modifying own cmdline (In fact, __argv[0]) is used very > often to signal the process state down to the user, > I was never thinking of modifying argc: > main (int argc, char **argv) > :-) > > > JK > -- > View this message in context: http://old.nabble.com/-proc-*-cmdline-corrupted-tp32639066p32663265.html > Sent from the Cygwin list mailing list archive at Nabble.com. > > > -- > Problem reports: http://cygwin.com/problems.html > FAQ: http://cygwin.com/faq/ > Documentation: http://cygwin.com/docs.html > Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple > > -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |