Hello Philip. Philip Guenther wrote in <[email protected]>: |On Sat, 21 Dec 2019, Steffen Nurpmeso wrote: |> Philip Guenther wrote in <[email protected]\ |> l>: |>|On Sat, 21 Dec 2019, Steffen Nurpmeso wrote: |... |>|> /* There are problems with dup()ing of file-descriptors for child \ |>|> processes. |>|> * We have to somehow accomplish that the FILE* fp makes itself \ |>|> comfortable |>|> * with the *real* offset of the underlaying file descriptor. |>|> * POSIX Issue 7 overloaded fflush(3): if used on a readable \ |>|> stream, \ |>|> then |>|> * |>|> * if the file is not already at EOF, and the file is one \ |>|> capable of |>|> * seeking, the file offset of the underlying open file descriptio\ |>|> n \ |>|> shall |>|> * be set to the file position of the stream */ |>| |>|Wheee: do _any_ BSDs implement that? A quick eyeball of Net, Free, and |>|Dragonfly find they all do nothing and return either EBADF (Net, \ |>|Open) or |>|0 (Free, Dragonfly), the latter with a citation to SUSv3. |> |> The test runs on FreeBSD 11.2,3-RC2/12 and also Dragonfly 5.6.1, |> as well as SunOS 5.9..11, GNU and musl Linux. That is all i have |> at the moment. | |Can you provide a more specific test case which passes on glibc and either |FreeBSD or Dragonfly but not on OpenBSD? | |The quick test program I whipped up below gives consistent results on
Ok, i am too tired and frustrated because i will not be able to do a release of my mailer before Christmas. (For example using Coverity directly, not over Github seems to have become unusable, i am waiting for over three days for a result, i sent it with ~565 build before me in the queue, and today still 551 builds are before me!) Your test program does not go over a subprocess, for example. It is all fine if i read the file in the child process, but before the exec. Yes, i thought the error was on my side and it took at least five hours or even longer to have instrumented the code enough etc. to finally believe me that it was really on the OpenBSD side. So yes, if you have git you could do git clone https://git.sdaoden.eu/scm/s-nail.git You could use --single-branch -b next to save download (you will not see the diff(1) of the failed test then, but it will fail). (You need the test-out branch for this, too.) Then just run "make devel" or "make all" and then you can git checkout next make devel # or make all ./mx-test.sh --run-test ./s-nail can_send_rfc That will succeed now. Apply diff --git a/include/mx/nailfuns.h b/include/mx/nailfuns.h index 7c1e5a41..b911c264 100644 --- a/include/mx/nailfuns.h +++ b/include/mx/nailfuns.h @@ -76,7 +76,7 @@ struct quoteflt; * if the file is not already at EOF, and the file is one capable of * seeking, the file offset of the underlying open file description shall * be set to the file position of the stream */ -#if !su_OS_OPENBSD &&\ +#if \ defined _POSIX_VERSION && _POSIX_VERSION + 0 >= 200809L # define n_real_seek(FP,OFF,WH) (fseek(FP, OFF, WH) != -1 && fflush(FP) != EOF) # define really_rewind(stream) \ via git apply make clean make ./mx-test.sh --run-test ./s-nail can_send_rfc and the test will now fail. This i have just verified on OpenBSD 6.6: #?0|o-0606-x86:nail.git$ ./mx-test.sh --run-test ./s-nail can_send_rfc Mode: --run-test, binary: ./s-nail Trying to detect UTF-8 locale via /home/steffen/src/nail.git/.obj/./s-nail Using Unicode locale C.UTF-8 ... [can_send_rfc] [can_send_rfc] 1:ok 1-err:ok 2:ok 2-err:ok 2no:ok 2no-err:ok 3:ok 3-err:ok 4:ok 4-err:ok 5:ok 5-err:ok 6:ok 6-err:ok 7:ok 8:ok 8-1:ok 9:ok 9-1:ok 9-2:ok ERROR: 10: checksum mismatch (got 3944910939 155) 10-1:ok 10-2:ok 11:ok 11-1:ok 11-2:ok ERROR: 12: checksum mismatch (got 3944910939 155) 12-1:ok 12-2:ok 29 tests: 27 ok, 2 failure(s). 0 test(s) skipped Elapsed seconds: 1 #?1|o-0606-x86:nail.git$ cat .obj/t.*.diff --- ../t.can_send_rfc-10.old Tue Dec 24 01:38:31 2019 +++ ../t.can_send_rfc-10 Tue Dec 24 01:38:31 2019 @@ -1,9 +1,3 @@ From reproducible_build Wed Oct 2 01:50:07 1996 -Date: Wed, 02 Oct 1996 01:50:07 +0000 -To: [email protected], [email protected], [email protected], [email protected] -Cc: [email protected], [email protected], [email protected] -Bcc: [email protected], [email protected], [email protected] -Subject: Sub.mta-1 - ARGS: -i -- [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] --- ../t.can_send_rfc-12.old Tue Dec 24 01:38:32 2019 +++ ../t.can_send_rfc-12 Tue Dec 24 01:38:32 2019 @@ -1,9 +1,3 @@ From reproducible_build Wed Oct 2 01:50:07 1996 -Date: Wed, 02 Oct 1996 01:50:07 +0000 -To: [email protected], [email protected], [email protected], [email protected] -Cc: [email protected], [email protected], [email protected] -Bcc: [email protected], [email protected], [email protected] -Subject: Sub.mta-1 - ARGS: -i -- [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] The tests run without errors on any other tested system, i have just verified again on FreeBSD 11.3-RC2. #?0|f-1103-rc2-x86:nail.git$ git describe --tags HEAD v14.9.15-262-g449d711c #?0|f-1103-rc2-x86:nail.git$ ./mx-test.sh --run-test ./s-nail can_send_rfc Mode: --run-test, binary: ./s-nail Trying to detect UTF-8 locale via /usr/home/steffen/src/nail.git/.obj/./s-nail Using Unicode locale en_US.UTF-8 ... [can_send_rfc] [can_send_rfc] 1:ok 1-err:ok 2:ok 2-err:ok 2no:ok 2no-err:ok 3:ok 3-err:ok 4:ok 4-err:ok 5:ok 5-err:ok 6:ok 6-err:ok 7:ok 8:ok 8-1:ok 9:ok 9-1:ok 9-2:ok 10:ok 10-1:ok 10-2:ok 11:ok 11-1:ok 11-2:ok 12:ok 12-1:ok 12-2:ok 29 tests: 29 ok, 0 failure(s). 0 test(s) skipped Elapsed seconds: 0 The problem manifests in src/mx/sendout.c:a_sendout_mta_start(), we take the rv!=TRU1 branch (it is a file-based MTA), but it is not TRUM1 (not the builtin TEST MTA), so we fall through over mx_child_fork(), and land in jkid:. In there, before the execv(), you can read regulary (after clearerr() in the case we talk about now). Whereas the soon execv() kid cannot. I could maybe create a short reproducer, but not the next couple of days, and then i really want to shipout the release, _this_year_!, but maybe thereafter? This is all i know. Ciao, and a nice Christmas from Germany, --steffen | |Der Kragenbaer, The moon bear, |der holt sich munter he cheerfully and one by one |einen nach dem anderen runter wa.ks himself off |(By Robert Gernhardt)
