Bug 194013

Summary: xfig ignores its command line arguments
Product: [Fedora] Fedora Reporter: Jean-Luc Richier <jean-luc.richier>
Component: xfigAssignee: Than Ngo <than>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 5   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-06-07 16:11:42 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 Jean-Luc Richier 2006-06-04 17:47:22 UTC
Description of problem:
xfig ignores the arguments on the command line


Version-Release number of selected component (if applicable):
xfig-3.2.4-17.2.i386

How reproducible:
try any argument, e.g. xfig -help, xfig does not list help

Steps to Reproduce:
1. % xfig -help 
2.
3.
  
Actual results:
starts xfig window

Expected results:
show print the help

Additional info:
The Reason is that in FC5 (at least xfig-3.2.4-17.2), /usr/bin/xfig is a shell
wrapper which sets env and then calls "exec /usr/bin/xfig.bin" without copying
the command line arguments.

To correct, apply the following patch:

--- /usr/bin/xfig.DIST  2006-02-12 19:59:07.000000000 +0100
+++ /usr/bin/xfig       2006-06-04 19:48:26.000000000 +0200
@@ -1,4 +1,4 @@
 #! /bin/sh
 export XAPPLRESDIR=/usr/share/X11/app-defaults
 export LANG=${LANG%.UTF-8}
-exec /usr/bin/xfig.bin
+exec /usr/bin/xfig.bin "$@"

Comment 1 Jean-Luc Richier 2006-06-04 18:13:32 UTC
Sorry, my path is not sufficient, as the binary xfig seems to ignore the
arguments if its name is not xfig (in fc5, the it is xfig.bin)
This is shown by trying xfig -metric: the display is still in inches.

So a full correction is the following
1/ Put the ELF binary in some directory with name xfig, for example
/usr/libexec/xfig
2/ Apply this patch
--- /usr/bin/xfig.DIST  2006-02-12 19:59:07.000000000 +0100
+++ /usr/bin/xfig       2006-06-04 20:11:08.000000000 +0200
@@ -1,4 +1,4 @@
 #! /bin/sh
 export XAPPLRESDIR=/usr/share/X11/app-defaults
 export LANG=${LANG%.UTF-8}
-exec /usr/bin/xfig.bin
+exec /usr/libexec/xfig "$@"

PS : the bug in xfig is explicitely said to be fixed in the source of xfig!
cf. the CHANGE file in source rpm:
o If xfig was renamed to anything else, the command-line arguments and X
resources weren't parsed by the Intrinsics.  This is fixed.


Comment 2 Jean-Luc Richier 2006-06-05 11:46:06 UTC
A other solution for the bug is to force the application name in the wrapper,
that is:
1/ leave the ELF binary as /usr/bin/xfig.bin
2/ Apply this patch
--- /usr/bin/xfig.DIST  2006-02-12 19:59:07.000000000 +0100
+++ /usr/bin/xfig       2006-06-05 13:48:20.000000000 +0200
@@ -1,4 +1,5 @@
 #! /bin/sh
 export XAPPLRESDIR=/usr/share/X11/app-defaults
 export LANG=${LANG%.UTF-8}
-exec /usr/bin/xfig.bin
+export RESOURCE_NAME=xfig
+exec /usr/bin/xfig.bin "$@"


Comment 3 Jean-Luc Richier 2006-06-05 14:08:28 UTC
I was still trying to correct the binray itself, but it seems complicated, so I
submit a bug report to xfig
I found an other simpler solution as the wrapper is using bash: use the -a
option of exec to force the command name ==>
1/ leave the ELF binary as /usr/bin/xfig.bin
2/ Apply this patch
--- /usr/bin/xfig.DIST  2006-02-12 19:59:07.000000000 +0100
+++ /usr/bin/xfig       2006-06-05 16:14:40.000000000 +0200
@@ -1,4 +1,4 @@
 #! /bin/sh
 export XAPPLRESDIR=/usr/share/X11/app-defaults
 export LANG=${LANG%.UTF-8}
-exec /usr/bin/xfig.bin
+exec -a xfig /usr/bin/xfig.bin "$@"


Comment 4 Than Ngo 2006-06-07 16:11:42 UTC
xfig from rawhide does not use the wrapper anymore. I will build
new xfig for FC5 update soon. Thanks for your report.