From owner-freebsd-fs Fri Aug 17 15:14:45 2001 Delivered-To: freebsd-fs@freebsd.org Received: from flood.ping.uio.no (flood.ping.uio.no [129.240.78.31]) by hub.freebsd.org (Postfix) with ESMTP id 7729B37B409 for ; Fri, 17 Aug 2001 15:14:41 -0700 (PDT) (envelope-from des@ofug.org) Received: (from des@localhost) by flood.ping.uio.no (8.9.3/8.9.3) id AAA80390; Sat, 18 Aug 2001 00:13:59 +0200 (CEST) (envelope-from des@ofug.org) X-URL: http://www.ofug.org/~des/ X-Disclaimer: The views expressed in this message do not necessarily coincide with those of any organisation or company with which I am or have been affiliated. To: Josef Karthauser Cc: freebsd-fs@FreeBSD.ORG Subject: Re: parsing problem with /proc/N/status References: <20010817102549.A712@tao.org.uk> From: Dag-Erling Smorgrav Date: 18 Aug 2001 00:13:59 +0200 In-Reply-To: <20010817102549.A712@tao.org.uk> Message-ID: Lines: 27 User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-fs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Josef Karthauser writes: > I've raised PR29682 about a problem parsing /proc/N/status (procfs) in > -current. The problem occurs when process names contain spaces, like > all of the 'irqN: xxx' ones do. Is there a procfs guru here that would > mind taking a look for me? I'm not a guru, but I'm the closest thing to a maintainer procfs has at the moment. The problem you describe is not limited to -CURRENT, nor to interrupt threads: des@xxxxx ~% uname -a FreeBSD xxxxx.xxxx.xxx.xx 3.5-STABLE FreeBSD 3.5-STABLE #1: Fri Apr 27 09:54:47 CEST 2001 des@xxxxx.xxxx.xxx.xx:/usr/src/sys/compile/XXXXX i386 des@xxxxx ~% cp /bin/cat 'c a t' des@xxxxx ~% ./c\ a\ t /proc/curproc/status c a t 80330 75065 80330 75065 5,1 ctty 998085659,268032 0,0 0,0 nochan 2602 2602 12602,12602,12602,0,69,4711,11000,11002,11381,99 There is no good solution. The ideal fix would be to use NUL characters instead of spaces to separate the fields (as is done for cmdline), but that would (obviously) break backwards compatibility. Replacing spaces with underscores like your patch does is a hack (and only a partial hack at that - the process name might contain a newline). If we have to go down that road, I'd rather just encode whitespace and unprintables in octal notation (like ls -B does). DES -- Dag-Erling Smorgrav - des@ofug.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-fs" in the body of the message