Bug 62981
| Summary: | misused option causes segfault | ||
|---|---|---|---|
| Product: | [Retired] Red Hat Linux | Reporter: | Peter Bieringer <pb> |
| Component: | patch | Assignee: | Tim Waugh <twaugh> |
| Status: | CLOSED RAWHIDE | QA Contact: | Brock Organ <borgan> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 7.2 | CC: | jakub |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | i686 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2002-04-09 13:36:18 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
Peter Bieringer
2002-04-08 21:13:28 UTC
This boils down to the following test case:
a.c:
==>
char program_name[] = "patch";
<==
b.c:
==>
#include <stdio.h>
extern char *program_name;
int main ()
{
fprintf (stderr, "%s\n", program_name);
}
<==
which also segfaults. Jakub, is there any chance this is a compiler problem?
No, it is a common programming bug. char program_name[] = "patch"; is not equal to char *program_name = "patch"; in C, likewise extern char program_name[]; is not equal to extern char *program_name; The two must agree. in the former case program_name symbol points to 'p' letter in "patch", in the latter case program_name symbol points to a pointer which points to "patch". Okay, thanks. Fixed package is 2.5.4-12. |