Re: mksh: [bug] command line option -m ineffective

2018-05-08 Thread Thorsten Glaser
Seb dixit:

>As if '-m' was just ignored.

It gets worse: if “-m” is passed, interactive is also broken.

I’ve tracked this down to between pdksh 4.0 (usenet posting)
and pdksh-5.0.6.tar.gz, even the changelog entry I believe
responsible, and I agree it’s probably a thinko instead of
intended behaviour.

Fixed in: @(#)MIRBSD KSH R56 2018/05/08

Thanks,
//mirabilos
-- 
Yay for having to rewrite other people's Bash scripts because bash
suddenly stopped supporting the bash extensions they make use of
-- Tonnerre Lombard in #nosec


Re: mksh: [bug] command line option -m ineffective

2018-05-08 Thread Seb
On Tue, May 08, 2018 at 04:44:00PM +0200, G.raud wrote:

> My goal here is to check when job control is enabled; case (2)
> is conform to the manpage as is your example; however case (1)
> is not hence the bug report.

Ah yes. I totally missed your point, sorry! Indeed:

  $ mksh -c 'sleep 1 & fg'   # ok.
  mksh: fg: job control not enabled
  $ mksh -m -c 'sleep 1 & fg'# not ok. 
  mksh: fg: job control not enabled

Curiously, It works as expected with the -i option (which implies
the job monitor):

  $ mksh -i -c 'fg'
  mksh: fg: %%: no such job

As if '-m' was just ignored.

You're also right for the xclock case; bash works as expected.

Sorry again,
Seb.





Re: mksh: [bug] command line option -m ineffective

2018-05-08 Thread G.raud
On Tue, May 08, 2018 at 03:12:45PM +0200, Seb wrote:
> On Tue, May 08, 2018 at 12:49:40PM +0200, G.raud wrote:
> 
> Hi,
> 
> > $ mksh -m -c 'fg'
> > mksh: fg: job control not enabled
> > $ mksh -c 'set -m; fg'
> > mksh: fg: %%: no such job
> 
> There is indeed no job to get from the the process' background:
> 
>  $ mksh -c 'set -m; sleep 1 & fg'
>  \sleep 1

My goal here is to check when job control is enabled; case (2) is
conform to the manpage as is your example; however case (1) is not hence
the bug report.

> > $ ksh -m -c 'xclock& sleep 2'
> > ^Z[1] + Stopped  ksh -m -c "xclock& sleep 2"
> > $ # xclock is not refreshed
> > $ fg
> 
> Ctrl+Z sends a SIGTSTP (not a SIGSTOP) to the ksh's process
> group, 'xclock' hence stops.

Which proves that xclock is in the same process group as the shell,
hence that job control is disabled contrary to what option -m should do.

-- 
G.raud


mksh: [bug] command line option -m ineffective

2018-05-08 Thread G.raud
Hello,

I have run the following test with both mksh 54 and 56c (from Debian)
that shows that a command line option -m (or -o monitor) does not enable
job control (contrary to what the manpage indicates):

---
$ mksh -m -c 'fg'
mksh: fg: job control not enabled
$ mksh -c 'set -m; fg'
mksh: fg: %%: no such job
---

The same holds for pdksh, as well as for ksh (testing using an X11 app
since fg does not print an error message in non interactive mode):
---
$ ksh -m -c 'xclock& sleep 2'
^Z[1] + Stopped  ksh -m -c "xclock& sleep 2"
$ # xclock is not refreshed
$ fg
ksh -c "set -m; xclock& sleep 2"
$ ksh -c 'set -m; xclock& sleep 2'
^Z[1] + Stopped  ksh -c "set -m; xclock& sleep 2" 
$ # xclock is still refreshed
$ fg
ksh -c "set -m; xclock& sleep 2"
---

Regards,
-- 
G.raud