Skip to contentSkip to conversation

t1308 - Bad return value from test-tool

Possible Breakage Randall S. Becker 2 participants 5 messages Feb 8, 2019 – Feb 10, 2019

lore
Share & tools
lore
#0 lore raw

t1308 has me perplexed - this is an old breakage on the NonStop platform, that I have just gotten around to checking with the new bash version we have. When running sub-test 23, the following was reported:

Value not found for "foo.bar"
test_expect_code: command exited with 1, we wanted 2 test-tool config configset_get_value foo.bar a-directory

However, when I looked inside t/helper/test-config.c, every path reporting "Value not found" has a goto exit1 not exit2. It seems, from the code, that the test is actually incorrect and should be expecting 1 not 2, and that it is working properly on NonStop (but the test fails as a result).

What is perplexing is that someone else should be seeing this. The test-config.c code is about 5 years old, but the test was modified a year or two ago. What am I missing here?

Cheers,
Randall

#1 lore raw
Quoted 4 lines · Randall S. Becker

t1308 has me perplexed - this is an old breakage on the NonStop platform, that I have just gotten around to checking with the new bash version we have. When running sub-test 23, the following was reported:

Quoted 8 lines

Value not found for "foo.bar"
test_expect_code: command exited with 1, we wanted 2 test-tool config configset_get_value foo.bar a-directory

However, when I looked inside t/helper/test-config.c, every path reporting "Value not found" has a goto exit1 not exit2. It seems, from the code, that the test is actually incorrect and should be expecting 1 not 2, and that it is working properly on NonStop (but the test fails as a result).

We're expecting it to report an error reading the directory, not "value not found". Which would yield code 2.

It sounds like you might need to set FREAD_READS_DIRECTORIES in your config.mak.

-Peff

#2 lore raw
Quoted 14 lines · Jeff King
Quoted 4 lines · Randall S. Becker

t1308 has me perplexed - this is an old breakage on the NonStop platform, that I have just gotten around to checking with the new bash version we have. When running sub-test 23, the following was reported:

Quoted 8 lines

Value not found for "foo.bar"
test_expect_code: command exited with 1, we wanted 2 test-tool config configset_get_value foo.bar a-directory

However, when I looked inside t/helper/test-config.c, every path reporting "Value not found" has a goto exit1 not exit2. It seems, from the code, that the test is actually incorrect and should be expecting 1 not 2, and that it is working properly on NonStop (but the test fails as a

Quoted 7 lines

result).

We're expecting it to report an error reading the directory, not "value not found". Which would yield code 2.

It sounds like you might need to set FREAD_READS_DIRECTORIES in your config.mak.

Setting FREAD_READS_DIRECTORIES = UnfortunatelyYes

still results in

Value not found for "foo.bar"
test_expect_code: command exited with 1, we wanted 2 test-tool config configset_get_value foo.bar a-directory not ok 23 - proper error on directory "files"
#

#               echo "Error (-1) reading configuration file a-directory." >expect &&
#               mkdir a-directory &&
#               test_expect_code 2 test-tool config configset_get_value foo.bar a-directory 2>output &&
#               grep "^warning:" output &&
#               grep "^Error" output >actual &&
#               test_cmp expect actual

#

I don't think that helped. While fopen can open a directory, fread does not return any data in this platform. readdir or nftw/ftw are pretty much the only options. However, the code still goes down the goto exit1 path in this situation.

Perplexed,
Randall

#3 lore raw
Quoted 4 lines · Randall S. Becker
Quoted 2 lines

It sounds like you might need to set FREAD_READS_DIRECTORIES in your config.mak.

Setting FREAD_READS_DIRECTORIES = UnfortunatelyYes

Silly question, but you did rebuild after setting that, not just re-run the tests, right?

Quoted 12 lines

still results in

Value not found for "foo.bar"
test_expect_code: command exited with 1, we wanted 2 test-tool config configset_get_value foo.bar a-directory not ok 23 - proper error on directory "files"
#

#               echo "Error (-1) reading configuration file a-directory." >expect &&
#               mkdir a-directory &&
#               test_expect_code 2 test-tool config configset_get_value foo.bar a-directory 2>output &&
#               grep "^warning:" output &&
#               grep "^Error" output >actual &&
#               test_cmp expect actual
Quoted 6 lines

#

I don't think that helped. While fopen can open a directory, fread does not return any data in this platform. readdir or nftw/ftw are pretty much the only options. However, the code still goes down the goto exit1 path in this situation.

Hrm. That's the exact case FREAD_READS_DIRECTORIES is supposed to help. It does an fstat() after fopen()ing the file to see if it points to a directory, and if so closes it immediately and returns EISDIR.

Can you confirm via debugger (or printf statements) that we make it into git_fopen, and what the resulting st.st_mode we see looks like?

-Peff

#4 lore raw
Quoted 9 lines · Jeff King
Quoted 4 lines · Randall S. Becker
Quoted 2 lines

It sounds like you might need to set FREAD_READS_DIRECTORIES in your config.mak.

Setting FREAD_READS_DIRECTORIES = UnfortunatelyYes

Silly question, but you did rebuild after setting that, not just re-run the tests, right?

Yes make was run, but some doofus (me) did not run make tests first, so test-tool was out of date, post reconfigure. When just a code change is made, test-tool gets build. I was/am confused.

Quoted 22 lines
Quoted 5 lines

still results in

Value not found for "foo.bar"
test_expect_code: command exited with 1, we wanted 2 test-tool config configset_get_value foo.bar a-directory not ok 23 - proper error on

directory "files"

Quoted 2 lines

#
# echo "Error (-1) reading configuration file a-directory." >expect

&&

Quoted 2 lines

# mkdir a-directory &&
# test_expect_code 2 test-tool config configset_get_value foo.bar

a-directory 2>output &&

Quoted 9 lines
#               grep "^warning:" output &&
#               grep "^Error" output >actual &&
#               test_cmp expect actual

#

I don't think that helped. While fopen can open a directory, fread does not return any data in this platform. readdir or nftw/ftw are pretty much the only options. However, the code still goes down the goto exit1 path in this situation.

Quoted 6 lines

Hrm. That's the exact case FREAD_READS_DIRECTORIES is supposed to help. It does an fstat() after fopen()ing the file to see if it points to a directory, and if so closes it immediately and returns EISDIR.

Can you confirm via debugger (or printf statements) that we make it into git_fopen, and what the resulting st.st_mode we see looks like?

It did not get into git_fopen at all. Subtest 1 did, but that's no surprise.

t1308 is passes now, finally. Patch coming.

Thanks for the help,
Randall