[Bug 191019] pgrep/pkill -j testcases fail on 11-CURRENT

2014-07-07 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=191019

--- Comment #3 from yaneurab...@gmail.com ---
The pgrep issues are test bugs. The assumption that the test script makes is
that the forked background process is the same as the value returned by pgrep.
pgrep is returning the PID of the process from within the jail:

Script started on Mon Jul  7 15:02:12 2014
command: sh -x ./pgrep-j_test
+ basename ./pgrep-j_test
+ base=pgrep-j_test
+ id -u
+ [ 0 -ne 0 ]
+ echo 1..3
1..3
+ mktemp -d /usr/tests/bin/pkill/pgrep-j_test.XXX
+ tmpdir=/usr/tests/bin/pkill/pgrep-j_test.bihmF9M
+ cd /usr/tests/bin/pkill/pgrep-j_test.bihmF9M
+ trap 'cd /; jls jid name | grep pgrep-j_test | xargs -n 1 jail -R ; rm -Rf
/usr/tests/bin/pkill/pgrep-j_test.bihmF9M' EXIT
+ pwd
+ sleep=/usr/tests/bin/pkill/pgrep-j_test.bihmF9M/sleep.txt
+ ln -f /bin/sleep /usr/tests/bin/pkill/pgrep-j_test.bihmF9M/sleep.txt
+ name='pgrep -j jid'
+ chpid=63235
+ _jail pgrep-j_test_1-1 /usr/tests/bin/pkill/pgrep-j_test.bihmF9M/sleep.txt 5
+ local name=pgrep-j_test_1-1
+ shift
+ jail -c path=/ host.hostname=pgrep-j_test_1-1 name=pgrep-j_test_1-1
ip4.addr=127.0.0.1 command=/usr/tests/bin/pkill/pgrep-j_test.bihmF9M/sleep.txt
5
+ chpid2=63236
+ chpid3=63237
+ sleep 0.5
+ _jail pgrep-j_test_1-2 /usr/tests/bin/pkill/pgrep-j_test.bihmF9M/sleep.txt 5
+ local name=pgrep-j_test_1-2
+ shift
+ jail -c path=/ host.hostname=pgrep-j_test_1-2 name=pgrep-j_test_1-2
ip4.addr=127.0.0.1 command=/usr/tests/bin/pkill/pgrep-j_test.bihmF9M/sleep.txt
5
+ /usr/tests/bin/pkill/pgrep-j_test.bihmF9M/sleep.txt 5
+ ps auxww
+ grep /usr/tests/bin/pkill/pgrep-j_test.bihmF9M/sleep.txt
root  63235   0.0  0.0  18476 1676  0  S+3:02PM 0:00.00 jail -c path=/
host.hostname=pgrep-j_test_1-1 name=pgrep-j_test_1-1 ip4.addr=127.0.0.1
command=/usr/tests/bin/pkill/pgrep-j_test.bihmF9M/sleep.txt 5
root  63236   0.0  0.0  18476 1676  0  S+3:02PM 0:00.00 jail -c path=/
host.hostname=pgrep-j_test_1-2 name=pgrep-j_test_1-2 ip4.addr=127.0.0.1
command=/usr/tests/bin/pkill/pgrep-j_test.bihmF9M/sleep.txt 5
root  63237   0.0  0.0   8036 1360  0  S+3:02PM 0:00.00
/usr/tests/bin/pkill/pgrep-j_test.bihmF9M/sleep.txt 5
root  63239   0.0  0.0   8036 1360  0  S+J   3:02PM 0:00.00
/usr/tests/bin/pkill/pgrep-j_test.bihmF9M/sleep.txt 5
root  63240   0.0  0.0   8036 1360  0  S+J   3:02PM 0:00.00
/usr/tests/bin/pkill/pgrep-j_test.bihmF9M/sleep.txt 5
root  63242   0.0  0.0  18608 1992  0  R+3:02PM 0:00.00 grep
/usr/tests/bin/pkill/pgrep-j_test.bihmF9M/sleep.txt
+ jls jid name
+ awk '$2 == pgrep-j_test_1-1 {print $1}'
+ jid=136
+ pgrep -f -j 136 /usr/tests/bin/pkill/pgrep-j_test.bihmF9M/sleep.txt
+ pid=63239
+ [ 63239 = 63235 ]
+ echo 'not ok 1 - pgrep -j jid'
not ok 1 - pgrep -j jid
+ sleep 7
+ name='pgrep -j any'
+ chpid=63248
+ _jail pgrep-j_test_2-1 /usr/tests/bin/pkill/pgrep-j_test.bihmF9M/sleep.txt 5
+ local name=pgrep-j_test_2-1
+ shift
+ jail -c path=/ host.hostname=pgrep-j_test_2-1 name=pgrep-j_test_2-1
ip4.addr=127.0.0.1 command=/usr/tests/bin/pkill/pgrep-j_test.bihmF9M/sleep.txt
5
+ chpid2=63249
+ _jail pgrep-j_test_2-2 /usr/tests/bin/pkill/pgrep-j_test.bihmF9M/sleep.txt 5
+ local name=pgrep-j_test_2-2
+ shift
+ chpid3=63250
+ jail -c path=/ host.hostname=pgrep-j_test_2-2 name=pgrep-j_test_2-2
ip4.addr=127.0.0.1 command=/usr/tests/bin/pkill/pgrep-j_test.bihmF9M/sleep.txt
5
+ sleep 0.5
+ /usr/tests/bin/pkill/pgrep-j_test.bihmF9M/sleep.txt 5
+ ps auxww
+ grep /usr/tests/bin/pkill/pgrep-j_test.bihmF9M/sleep.txt
root  63248   0.0  0.0  18476 1676  0  S+3:02PM 0:00.01 jail -c path=/
host.hostname=pgrep-j_test_2-1 name=pgrep-j_test_2-1 ip4.addr=127.0.0.1
command=/usr/tests/bin/pkill/pgrep-j_test.bihmF9M/sleep.txt 5
root  63249   0.0  0.0  18476 1676  0  S+3:02PM 0:00.00 jail -c path=/
host.hostname=pgrep-j_test_2-2 name=pgrep-j_test_2-2 ip4.addr=127.0.0.1
command=/usr/tests/bin/pkill/pgrep-j_test.bihmF9M/sleep.txt 5
root  63250   0.0  0.0   8036 1360  0  S+3:02PM 0:00.00
/usr/tests/bin/pkill/pgrep-j_test.bihmF9M/sleep.txt 5
root  63252   0.0  0.0   8036 1360  0  S+J   3:02PM 0:00.00
/usr/tests/bin/pkill/pgrep-j_test.bihmF9M/sleep.txt 5
root  63253   0.0  0.0   8036 1360  0  S+J   3:02PM 0:00.00
/usr/tests/bin/pkill/pgrep-j_test.bihmF9M/sleep.txt 5
root  63255   0.0  0.0  18608 1992  0  R+3:02PM 0:00.00 grep
/usr/tests/bin/pkill/pgrep-j_test.bihmF9M/sleep.txt
+ pgrep -f -j any /usr/tests/bin/pkill/pgrep-j_test.bihmF9M/sleep.txt
+ sort
+ pids='63252
63253'
+ echo 63248
+ echo 63249
+ sort
+ refpids='63248
63249'
+ [ '63252
63253' = '63248
63249' ]
+ echo 'not ok 2 - pgrep -j any'
not ok 2 - pgrep -j any
+ sleep 7
+ name='pgrep -j none'
+ chpid=63263
+ /usr/tests/bin/pkill/pgrep-j_test.bihmF9M/sleep.txt 5
+ chpid2=63264
+ _jail pgrep-j_test_3 /usr/tests/bin/pkill/pgrep-j_test.bihmF9M/sleep.txt 5
+ local name=pgrep-j_test_3
+ shift
+ jail -c path=/ host.hostname=pgrep-j_test_3 name=pgrep-j_test_3
ip4.addr=127.0.0.1 

[Bug 191019] pgrep/pkill -j testcases fail on 11-CURRENT

2014-07-07 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=191019

--- Comment #4 from yaneurab...@gmail.com ---
Adding more data to the pgrep failures, it's jail(8) that does the forking:

575 pid = fork();
576 if (pid  0)
577 err(1, fork);
578 if (pid  0) {
579 if (bg || !add_proc(j, pid)) {
580 free(j-comline);
581 j-comline = NULL;
582 return 0;
583 } else {
584 paralimit--;
585 return 1;
586 }
587 }
588 if (bg)
589 setsid();

I fixed the issues with the pgrep -j testcases here:

https://github.com/yaneurabeya/freebsd/commit/95191312475104e2e7afd7cdec1452a031500d33

I'm starting to wonder if this forking in jail(8) is at the cruxt of the issue
with none as the pkill testcases work by killing the jail process, not the
sleep process running in the jail.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-bugs@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to freebsd-bugs-unsubscr...@freebsd.org


[Bug 191019] pgrep/pkill -j testcases fail on 11-CURRENT

2014-07-07 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=191019

--- Comment #5 from yaneurab...@gmail.com ---
Aha! The commands are missing the -x option:

 -x  Require an exact match of the process name, or argument list
 if -f is given.  The default is to match any substring.

With some more work, now the testcases pass 100%:
https://github.com/yaneurabeya/freebsd/commit/7091f8f4e13171a7f122ead5a63a54c9d0a0de30

Script started on Mon Jul  7 17:06:51 2014
command: sh -c cd /usr/tests/bin/pkill/ ; kyua test; prove -rv p*
pgrep-F_test:main  -  passed  [0.345s]^M
pgrep-LF_test:main  -  passed  [0.693s]^M
pgrep-P_test:main  -  passed  [0.354s]^M
pgrep-U_test:main  -  passed  [0.692s]^M
pgrep-_g_test:main  -  passed  [0.679s]^M
pgrep-_s_test:main  -  passed  [0.037s]^M
pgrep-g_test:main  -  passed  [0.691s]^M
pgrep-i_test:main  -  passed  [0.349s]^M
pgrep-j_test:main  -  passed  [24.439s]^M
pgrep-l_test:main  -  passed  [0.322s]^M
pgrep-n_test:main  -  passed  [0.341s]^M
pgrep-o_test:main  -  passed  [0.346s]^M
pgrep-q_test:main  -  passed  [0.353s]^M
pgrep-s_test:main  -  passed  [0.667s]^M
pgrep-t_test:main  -  passed  [0.352s]^M
pgrep-v_test:main  -  passed  [0.357s]^M
pgrep-x_test:main  -  passed  [0.360s]^M
pkill-F_test:main  -  passed  [0.336s]^M
pkill-LF_test:main  -  passed  [0.684s]^M
pkill-P_test:main  -  passed  [0.346s]^M
pkill-U_test:main  -  passed  [0.695s]^M
pkill-_g_test:main  -  passed  [0.687s]^M
pkill-g_test:main  -  passed  [0.681s]^M
pkill-i_test:main  -  passed  [0.349s]^M
pkill-j_test:main  -  passed  [19.325s]^M
pkill-s_test:main  -  passed  [0.679s]^M
pkill-t_test:main  -  passed  [0.680s]^M
pkill-x_test:main  -  passed  [0.690s]^M
^M
28/28 passed (0 failed)^M
Committed action 270^M

...

pgrep-v_test ... ^M
1..2^[[0m^M
ok 1 - pgrep -v^[[0m^M
ok 2 - pgrep -v^[[0m^M
ok^M
pgrep-x_test ... ^M
1..4^[[0m^M
ok 1 - pgrep -x^[[0m^M
ok 2 - pgrep -x^[[0m^M
ok 3 - pgrep -x -f^[[0m^M
ok 4 - pgrep -x -f^[[0m^M
ok^M
pkill-F_test ... ^M
1..1^[[0m^M
ok - pkill -F pidfile^[[0m^M
ok^M
pkill-LF_test .. ^M
1..2^[[0m^M
ok 1 - pkill -LF pidfile^[[0m^M
ok 2 - pkill -LF pidfile^[[0m^M
ok^M
pkill-P_test ... ^M
1..1^[[0m^M
ok - pkill -P ppid^[[0m^M
ok^M
pkill-U_test ... ^M
1..2^[[0m^M
ok 1 - pkill -U uid^[[0m^M
ok 2 - pkill -U user^[[0m^M
ok^M
pkill-_g_test .. ^M
1..2^[[0m^M
ok 1 - pkill -G gid^[[0m^M
ok 2 - pkill -G group^[[0m^M
ok^M
pkill-g_test ... ^M
1..2^[[0m^M
ok 1 - pkill -g pgrp^[[0m^M
ok 2 - pkill -g 0^[[0m^M
ok^M
pkill-i_test ... ^M
1..1^[[0m^M
ok - pkill -i^[[0m^M
ok^M
pkill-j_test ... ^M
1..3^[[0m^M
jail: /usr/tests/bin/pkill/pkill-j_test.ujLT6PV/sleep.txt 5: exited on signal
15^M
kill: 10901: No such process^M
ok 1 - pkill -j jid^[[0m^M
jail: /usr/tests/bin/pkill/pkill-j_test.ujLT6PV/sleep.txt 5: exited on signal
15^M
jail: /usr/tests/bin/pkill/pkill-j_test.ujLT6PV/sleep.txt 5: exited on signal
15^M
kill: 10913: No such process^M
kill: 10914: No such process^M
ok 2 - pkill -j any^[[0m^M
ok 3 - pkill -j none^[[0m^M
kill: 10922: No such process^M
jail: pkill-j_test_1-2 not found^M
jail: pkill-j_test_3 not found^M
ok^M
pkill-s_test ... ^M
1..2^[[0m^M
ok 1 - pkill -s sid^[[0m^M
ok 2 - pkill -s 0^[[0m^M
ok^M
pkill-t_test ... ^M
1..2^[[0m^M
ok 1 - pkill -t tty^[[0m^M
ok 2 - pkill -t tty^[[0m^M
ok^M
pkill-x_test ... ^M
1..4^[[0m^M
ok 1 - pkill -x^[[0m^M
ok 2 - pkill -x^[[0m^M
ok 3 - pkill -x -f^[[0m^M
ok 4 - pkill -x -f^[[0m^M
ok^M
^[[32mAll tests successful.^M
^[[0mFiles=28, Tests=55, 56 wallclock secs ( 0.18 usr  0.14 sys +  0.18 cusr 
0.91 csys =  1.41 CPU)^M
Result: PASS^M

Script done on Mon Jul  7 17:08:44 2014

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-bugs@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to freebsd-bugs-unsubscr...@freebsd.org


[Bug 191019] pgrep/pkill -j testcases fail on 11-CURRENT

2014-06-13 Thread bz-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=191019

--- Comment #1 from yaneurab...@gmail.com ---
Created attachment 143762
  -- https://bugs.freebsd.org/bugzilla/attachment.cgi?id=143762action=edit
pkill -j test failure log (06/2013)

From
http://kyua3.nyi.freebsd.org/head/data/0-LATEST/results/bin_pkill_pkill-j_test_main.html

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-bugs@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to freebsd-bugs-unsubscr...@freebsd.org


[Bug 191019] pgrep/pkill -j testcases fail on 11-CURRENT

2014-06-13 Thread bz-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=191019

--- Comment #2 from yaneurab...@gmail.com ---
Created attachment 143763
  -- https://bugs.freebsd.org/bugzilla/attachment.cgi?id=143763action=edit
pgrep -j test failure log (06/2013)

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-bugs@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to freebsd-bugs-unsubscr...@freebsd.org