delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/10/17/04:34:42

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RP_MATCHES_RCVD,T_TO_NO_BRKTS_FREEMAIL
X-Spam-Check-By: sourceware.org
Message-ID: <32665348.post@talk.nabble.com>
Date: Mon, 17 Oct 2011 01:34:16 -0700 (PDT)
From: "jan.kolar" <kolar AT math DOT cas DOT cz>
To: cygwin AT cygwin DOT com
Subject: Re: /proc/*/cmdline corrupted
In-Reply-To: <CAG_2cTn3km6ASEOK4rEGO=k6Kj=9RYpkRWL=2Beup2fi+hSp0A@mail.gmail.com>
MIME-Version: 1.0
References: <CAG_2cT=rmeJpmZbYDo7RAwjNcTTDSTH1SMhuzzL9qi09ZJwGyA AT mail DOT gmail DOT com> <32663265 DOT post AT talk DOT nabble DOT com> <CAG_2cTn3km6ASEOK4rEGO=k6Kj=9RYpkRWL=2Beup2fi+hSp0A AT mail DOT gmail 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




> I've checked and on Linux (at least) xterm's command line is not
> corrupted. 
That means: unchanged ?
Or, with -sl 2000 +tb removed ?
A version (!) of xterm on Linux, which does not know +tb option, does not
change cmdline. 

> 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).

Well, it depends whether it is xterm's intention to change the command line.
(And this would be a topic for cygwin-apps list I think.)
For example sendmail likes to do that  (on Linux):
       root      3051  sendmail: accepting connections
       smmsp 3061  sendmail: Queue runner AT 00:01:00 for
/var/spool/clientmqueue
       root     14631 sendmail: server [1.46.244.248] cmd read
       root     15254 sendmail: ./p9CDUban025571 mail3.cae3.com.: user open
entries of sendmail are not nullterminated (!).
Others have set (on Linux) a number of NULL pointers:
0000000   i   n   i   t       [   3   ]  \0  \0  \0  \0  \0  \0  \0  \0  \0 
\0
0000000   l   p   d       W   a   i   t   i   n   g  \0  \0  \0

Hence, XmParseCommand() would do better job if it would zero all unused
argv[index],
not just the first unused one.

---

* On the side of cygwin, the question is 

1. whether /proc should show the current content of command line,
   that is, what is the standard today.
  (I think at least $0 should have the current value, I do not know about
others.)
  The "\0 \0 \0" above suggests that the Linux's behavior = cygwin's
behavior.

2. How it should interpret NULL pointers in the array, either 
  as "for (int i = 0; i < __argc_safe; i++)"  or  as
  "for (char **a = __argv; *a; a++)". Both are present in pinfo.cc. 
  The "\0 \0 \0" above suggests that the Linux does it the first way.

(Note that the implications of "\0 \0 \0" and other observations are no more
than my speculations, that cannot replace a look at the code. :-) )
-- 
View this message in context: http://old.nabble.com/-proc-*-cmdline-corrupted-tp32639066p32665348.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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019