Bug 75315 - the shells/bash2 port is broken on -CURRENT
Summary: the shells/bash2 port is broken on -CURRENT
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Sam Lawrance
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-20 16:20 UTC by michiel
Modified: 2006-10-20 09:08 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description michiel 2004-12-20 16:20:22 UTC
The shells/bash2 port is broken on -CURRENT.
To be precise, it was broken by the import of GNU Readline 5.0
in src/contrib and the addition of the 'timestamp' member to the
HIST_ENTRY structure.
The brokenness manifests itself in coredumps (see How-To-Repeat section.)

Fix: 

To fix the particular coredump mentioned above, rebuild the port as
follows: do 'make extract', then
cp /usr/include/readline/history.h ./work/bash-2.05b/lib/readline/.
and then continue the make.
Obviously this is not a real fix that would give a person a warm, fuzzy
feeling.
How-To-Repeat: At the shell prompt, type a command that spans multiple lines, like
$ echo '
'
Then bring back the previous line using ^P and press enter.
Comment 1 michiel 2004-12-21 07:45:05 UTC
> http://www.freebsd.org/cgi/query-pr.cgi?pr=75315

Another workaround would be to use the bundled readline, as in

Index: Makefile
===================================================================
RCS file: /usr/ncvs/ports/shells/bash2/Makefile,v
retrieving revision 1.74
diff -u -r1.74 Makefile
--- Makefile	27 Oct 2004 22:13:04 -0000	1.74
+++ Makefile	21 Dec 2004 07:35:59 -0000
@@ -35,7 +35,6 @@
 USE_REINPLACE=	yes
 WRKSRC=		${WRKDIR}/bash-${PORTVERSION:C/\....$//}
 GNU_CONFIGURE=	Yes
-CONFIGURE_ARGS=	--with-installed-readline
 .if defined(WANT_STATIC_BASH) || defined(NO_DYNAMICROOT) || (defined(NOSHARED) && ( ${NOSHARED} != "no" && ${NOSHARED} != "NO" ))
 CONFIGURE_ARGS+= --enable-static-link
 .else

The above patch needs to be modified of course to preserve the working
setup for RELENG_5 etc, but I don't know how to do that.

The bash port is not broken, so another thing would be to
deinstall bash2 and use bash instead. (Why do I always discover things
like this right after I submit a PR.)
Comment 2 Sergey Matveychuk freebsd_committer freebsd_triage 2004-12-21 22:32:13 UTC
Responsible Changed
From-To: freebsd-ports-bugs->obrien

His port
Comment 3 Garance A Drosehn freebsd_committer freebsd_triage 2005-02-27 03:20:30 UTC
I just thought I would confirm that I run into this problem
very frequently, both on 5.x and 6.x systems.  Here are two
more simple ways to trigger it:

Type:

echo aaa \
bbb

then cursor-up and re-enter that line from history.

Type:

for fname in * ; do
echo $fname
done

When you enter the 'for', bash will come back with the '>'
prompt asking for the rest of your for loop.  After you
are done entering it, then cursor-up, and re-enter the
'for' loop.  bash2 will core-dump.  This is the situation
that nails me the most, because I always type in a test
'for' loop to make sure the loop will do exactly what I
want it to do, and then I re-enter enter the 'for' loop
after changing it (usually to delete 'echo' in front of
some command-lines).

I tried copying /usr/include/readline/history.h into the
work directory (after doing 'make patch'), and that did
seem to solve the problem.  I imagine the real fix will
need to be more complicated, to avoid breaking bash2 on
3.x or 4.x systems when fixing it for 5.x and 6.x systems.

-- 
Garance Alistair Drosehn     =      gad@gilead.netel.rpi.edu
Senior Systems Programmer               or   gad@FreeBSD.org
Rensselaer Polytechnic Institute;             Troy, NY;  USA
Comment 4 Garance A Drosehn freebsd_committer freebsd_triage 2005-02-27 03:25:44 UTC
Oops.  This is apparently only a problem on 6.x systems.  I
had tested on my usual 5.x testing-system, but now I notice
that that-system is presently booted up in 6.x...

-- 
Garance Alistair Drosehn     =      gad@gilead.netel.rpi.edu
Senior Systems Programmer               or   gad@FreeBSD.org
Rensselaer Polytechnic Institute;             Troy, NY;  USA
Comment 5 Mike Jakubik 2005-04-06 23:00:41 UTC
The problem goes away for me if i
recompile and reinstall /usr/src/contrib/libreadline,
/usr/src/gnu/lib/libreadline/ with these CFLAGs "-O -pipe -ggdb", followed
by a recompile of bash2. The default CFLAGs are "-O2 -fno-strict-aliasing
-pipe -march=athlon". Could this be a bug in libreadline/gcc due to
over optimization?
Comment 6 Garance A Drosehn freebsd_committer freebsd_triage 2005-04-07 20:22:42 UTC
As noted in my previous entries on this PR, the problem is in
the bash2 port.  It is not in the gcc compiler.

I do find it interesting that the problem apparently will go away
if you recompile the system readline library with different CFLAGS,
but the bash2 port *does* definitely have a version-skew problem
with readline in the 6.x-current base system, and if you fix that
problem then you will not need to change anything in the base
system.

-- 
Garance Alistair Drosehn     =      gad@gilead.netel.rpi.edu
Senior Systems Programmer               or   gad@FreeBSD.org
Rensselaer Polytechnic Institute;             Troy, NY;  USA
Comment 7 Sam Lawrance freebsd_committer freebsd_triage 2005-12-16 14:10:01 UTC
Responsible Changed
From-To: obrien->lawrance

Problem confirmed on 6.x, I'll have a stab at fixing it.
Comment 8 Arseny Nasokin 2006-06-30 03:46:23 UTC
I have no problems on todays -CURRENT without any make.conf hints (__MAKE_CONF=/dev/null)

I simply compile port. All crash-tests listed above doesn't fails.
Should it be closed?!
Comment 9 michiel 2006-07-02 15:32:14 UTC
> I simply compile port. All crash-tests listed above doesn't fails.
> Should it be closed?!

echo '
'
<cursor up>
<enter>

still crashes over here (7.0-CURRENT, bash-2.05b.007_4)
Comment 10 Sam Lawrance 2006-10-14 16:30:47 UTC
bash2 is a bit weird.  Even though you get the option of using a 
preinstalled version of readline, the build stupidly still uses bundled 
readline files.

I'm considering the following changes to the port:

1. When patching, delete the bundled copy of readline in 
bash-2.05b/lib/readline.  Add an empty Makefile.in just to keep 
configure from breaking.
2. Edit the bash-2.05b/Makefile.in so that RL_LIBSRC and HIST_LIBSRC 
point to /usr/include/readline.

I'm a bit worried about whether this change will cause undesired 
effects. OTOH, the port is currently building with mismatched headers, 
so it probably can't get much worse.
Comment 11 Sam Lawrance freebsd_committer freebsd_triage 2006-10-16 13:15:38 UTC
Noting that a patch is available at 
http://people.freebsd.org/~lawrance/patch-bash2 so that it doesn't get 
lost while the ports freeze is on.
Comment 12 dfilter service freebsd_committer freebsd_triage 2006-10-20 08:57:56 UTC
lawrance    2006-10-20 07:55:54 UTC

  FreeBSD ports repository

  Modified files:
    shells/bash2         Makefile 
  Log:
  bash2 links against the system readline, so patch it to build with the
  system readline headers too.  This prevents segfaults due to certain
  key sequences.
  
  PR:             ports/75315
  Submitted by:   Michiel Boland
  Approved by:    portmgr (marcus)
  Approved by:    obrien (maintainer, timeout 22 months)
  
  Revision  Changes    Path
  1.83      +4 -1      ports/shells/bash2/Makefile
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 13 Sam Lawrance freebsd_committer freebsd_triage 2006-10-20 09:07:54 UTC
State Changed
From-To: open->closed

Patch committed to build bash2 with system headers. 

Thanks all.