Problem (and--maybe incorrect--patch) in procfs

Yves Arrouye (arrouye@marin.fdn.fr)
Fri, 26 Jul 1996 15:34:44 +0200


Hello,

While reading command-line arguments from /proc entries, I noticed that
the eventual trailing spaces of the last argument are stripped, i.e if
I run

% cat '/tmp/a file '

I will get '/tmp/a file' as argument in the proc entry.

The get_array() function in array.c is responsible for that. It says
it removes trailing spaces used to pad argv/envp. But it doesn't look
like that this is necessary because if I remove that my system still
works nicely and the procps problem is corrected.

I enclose the patch in this mail. Could you please tell me if it is
okay, and then forward it to the appriopriate person?

Thanks,
Yves.

*** array.c.orig Fri Jul 26 00:50:21 1996
--- array.c Fri Jul 26 00:49:25 1996
***************
*** 25,30 ****
--- 25,33 ----
*
* Bruno Haible : remove 4K limit for the maps file
* <haible@ma2s2.mathematik.uni-karlsruhe.de>
+ *
+ * Yves Arrouye : remove removal of trailing spaces in get_array.
+ * <Yves.Arrouye@marin.fdn.fr>
*/

#include <linux/types.h>
***************
*** 370,376 ****
for (;;) {
addr = get_phys_addr(*p, start);
if (!addr)
! goto ready;
do {
c = *(char *) addr;
if (!c)
--- 373,379 ----
for (;;) {
addr = get_phys_addr(*p, start);
if (!addr)
! return result;
do {
c = *(char *) addr;
if (!c)
***************
*** 378,394 ****
if (size < PAGE_SIZE)
buffer[size++] = c;
else
! goto ready;
addr++;
start++;
if (!c && start >= end)
! goto ready;
} while (addr & ~PAGE_MASK);
}
- ready:
- /* remove the trailing blanks, used to fill out argv,envp space */
- while (result>0 && buffer[result-1]==' ')
- result--;
return result;
}

--- 381,393 ----
if (size < PAGE_SIZE)
buffer[size++] = c;
else
! return result;
addr++;
start++;
if (!c && start >= end)
! return result;
} while (addr & ~PAGE_MASK);
}
return result;
}

***************
*** 1210,1213 ****
NULL, /* bmap */
NULL, /* truncate */
NULL /* permission */
! };
\ No newline at end of file
--- 1209,1212 ----
NULL, /* bmap */
NULL, /* truncate */
NULL /* permission */
! };