BusyBox Bug and Patch Tracking
BusyBox
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0001859 [uClibc] Shared Library Support minor always 01-04-08 02:57 01-04-08 21:58
Reporter michael_d View Status public  
Assigned To uClibc
Priority normal Resolution fixed  
Status closed   Product Version
Summary 0001859: program_invocation_name and others not set with shared libc
Description Consider the following program:

#define _GNU_SOURCE
#include <errno.h>
#include <stdio.h>
#include <assert.h>

extern char *__progname;

int
main (int argc, char **argv)
{
  printf ("PISN = %s\nPIN = %s\n_PN = %s\n",
      program_invocation_short_name, program_invocation_name, __progname);
  /* assertion reveals the value of __uclibc_progname */
  assert (0);
}

The output of the program should be as follows:

$ progname
PISN = progname
PIN = ./progname
_PN = progname
progname: progname.c: 14: main: Assertion `0' failed.
Aborted

Yet the actual result on an unfixed, shared uClibc is:
$ ./progname
PISN = (null)
PIN = (null)
_PN = progname
(null): progname.c: 14: main: Assertion `0' failed.
Aborted


uClibc tries to arrange for __progname to occupy the same memory address as program_invocation_short_name and the hidden variable __uclibc_progname. It also arranges for program_invocation_name to similarly overlap the hidden variable __progname_full.

In __uClibc_main(), only one variable from each group is actually set.
This would be fine if the magic to overlap the variables actually worked. But it does not when uClibc is a shared library.

I've attached a patch which adds extra assignments so that all 5 variables are initialized.
Additional Information
Attached Files  uClibc-0.9.29-progname.diff [^] (698 bytes) 01-04-08 02:57

- Relationships

- Notes
(0003379)
vapier
01-04-08 21:58

thanks for the patch, but this has already been fixed in svn

dupe of 1310
 

- Issue History
Date Modified Username Field Change
01-04-08 02:57 michael_d New Issue
01-04-08 02:57 michael_d Status new => assigned
01-04-08 02:57 michael_d Assigned To  => uClibc
01-04-08 02:57 michael_d File Added: uClibc-0.9.29-progname.diff
01-04-08 21:58 vapier Note Added: 0003379
01-04-08 21:58 vapier Status assigned => closed
01-04-08 21:58 vapier Resolution open => fixed


Copyright © 2000 - 2006 Mantis Group
Powered by Mantis Bugtracker