Bug 239701 - shells/ksh93: shell dumps core when using time or times command (and more)
Summary: shells/ksh93: shell dumps core when using time or times command (and more)
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Cy Schubert
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-07 17:36 UTC by Andras Farkas
Modified: 2019-08-08 16:19 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (cy)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andras Farkas 2019-08-07 17:36:34 UTC
Starting out from the normal login shell, sh:

$ ksh93
$ time
../src/cmd/ksh93/sh/xec.c:2171: failed assertion 'tb.tv_sec'
Abort trap (core dumped)
$ ksh93
$ times
../src/cmd/ksh93/sh/xec.c:2171: failed assertion 'tb.tv_sec'
Abort trap (core dumped)

Also, what braindamaged person decided it was a good idea to make the ksh93 package be an ALPHA RELEASE rather than a stable release?

$ ksh93
$ echo $KSH_VERSION        
Version A 2020.0.0-alpha1

I didn't expect to be beta testing or alpha testing a shell when I installed ksh93 some time ago.  I actually use this shell both interactively and in scripts and I need it to work.
This isn't OK.
Please revert to Version AJM 93u+ 2012-08-01

Other info in case it's necessary:

$ freebsd-version -kru
12.0-RELEASE-p9
12.0-RELEASE-p9
12.0-RELEASE-p9
$ uname -a
FreeBSD nyann.tanasinn.mochi 12.0-RELEASE-p9 FreeBSD 12.0-RELEASE-p9 GENERIC  amd64

Let me know if you need the core file sent or something.
Comment 1 Cy Schubert freebsd_committer 2019-08-07 17:42:11 UTC
Can you try ksh93-devel port? If it fixes it I'll scour the att/ast github logs to find the patch. If it does not fix it I'll open an issue with att/ast on github.
Comment 2 Andras Farkas 2019-08-07 17:47:59 UTC
However, time [command] works as expected, as when trying out time ls and time sleep 1
Comment 3 Andras Farkas 2019-08-07 17:48:52 UTC
(In reply to Cy Schubert from comment #1)
Shall do in a moment, but maybe you should've put the alpha version in ksh93-devel instead of ksh93.
Comment 4 Andras Farkas 2019-08-07 17:53:42 UTC
(In reply to Cy Schubert from comment #1)
Just tested.  This problem does not exist in ksh93-devel and things related to time and times work correctly.
Comment 5 Walter Schwarzenfeld freebsd_triage 2019-08-07 17:58:55 UTC
change:

/src/cmd/ksh93/sh/xec.c:
2170             timeofday(&ta);
to
2170             timeofday(&tb);

should fix time

times is working on my machine.
Comment 6 Cy Schubert freebsd_committer 2019-08-07 18:06:10 UTC
Actually, shells/ksh93 is alpha. This was done because many people complained to att/ast that the previous version had many bugs which were unaddressed. Even though they were not prepared for a new release they tagged 2020-0-0 to satisfy the calls by users for a new ksh93 release. The last PRs submitted to FreeBSD documented many serious issues. One of the att/ast developers recommended to us that we use 2020-0-0 instead of the last released (ancient) ksh93. This fixed all open FreeBSD ksh93 PRs. Unfortunately we now have a new one.

ksh93-devel is their development branch. We can consider it pre-alpha. I have ksh93-devel installed here (I should have remembered that but I'm deep into an ipfilter problem right now -- my head is elsewhere). With ksh93-devel,

slippy$ time
user	0m0.000s
sys	0m0.000s
slippy$ echo $KSH_VERSION 
Version A 2020.0.0-alpha1
slippy$ 

I'll look through their git logs to find the patch.
Comment 7 Andras Farkas 2019-08-07 18:08:08 UTC
(In reply to Cy Schubert from comment #6)
I see.  Thank you for the info!
Comment 8 Cy Schubert freebsd_committer 2019-08-07 18:23:30 UTC
(In reply to w.schwarzenfeld from comment #5)
Upstream has replaced timeofday with gettimeofday(), so yes. That is the correct fix.
Comment 9 Cy Schubert freebsd_committer 2019-08-07 18:31:13 UTC
Committed to my local git tree, git svn dcommit in progress.
Comment 10 commit-hook freebsd_committer 2019-08-07 18:31:51 UTC
A commit references this bug:

Author: cy
Date: Wed Aug  7 18:31:14 UTC 2019
New revision: 508344
URL: https://svnweb.freebsd.org/changeset/ports/508344

Log:
  Fix:

  $ ksh93
  $ time
  ../src/cmd/ksh93/sh/xec.c:2171: failed assertion 'tb.tv_sec'
  Abort trap (core dumped)
  $ ksh93
  $ times
  ../src/cmd/ksh93/sh/xec.c:2171: failed assertion 'tb.tv_sec'
  Abort trap (core dumped)

  PR:		239701
  Suggested by:	w.schwarzenfeld@utanet.at
  MFH:		2019Q3

Changes:
  head/shells/ksh93/Makefile
  head/shells/ksh93/files/patch-src_cmd_ksh93_sh_xec.c
Comment 11 commit-hook freebsd_committer 2019-08-08 16:15:00 UTC
A commit references this bug:

Author: cy
Date: Thu Aug  8 16:14:47 UTC 2019
New revision: 508392
URL: https://svnweb.freebsd.org/changeset/ports/508392

Log:
  MFH: r508344

  Fix:

  $ ksh93
  $ time
  ../src/cmd/ksh93/sh/xec.c:2171: failed assertion 'tb.tv_sec'
  Abort trap (core dumped)
  $ ksh93
  $ times
  ../src/cmd/ksh93/sh/xec.c:2171: failed assertion 'tb.tv_sec'
  Abort trap (core dumped)

  PR:		239701
  Suggested by:	w.schwarzenfeld@utanet.at
  Approved by:	portmgr (delphij@)

Changes:
_U  branches/2019Q3/
  branches/2019Q3/shells/ksh93/Makefile
  branches/2019Q3/shells/ksh93/files/patch-src_cmd_ksh93_sh_xec.c