gregorio-project / gregorio-test

A repository of tests for Gregorio
GNU General Public License v3.0
5 stars 3 forks source link

Added code to handle more oddities in file naming. #328

Closed henryso closed 5 years ago

henryso commented 6 years ago

Please note that this changes the VIEW / DIFF settings in the gregorio-test.rc file. See the example file for the required format. Basically, what used to be a string should now be an array. For example, what was:

VIEW_TEXT="less {file}"

should now be

VIEW_TEXT=( less {file} )

This is to support weird filenames for gregorio-project/gregorio#1426.

This also pulls in some bug fixes from the develop branch, but these are acceptable for the ctan branch as well.

rpspringuel commented 6 years ago

This fix isn't working for me because of the output directory. The testing program creates fix'1416.tex.out as the destination for the output of the LuaLaTeX compile. However, GregorioTeX, using the renaming rules I've given it outputs the following warnings:

Module gregoriotex Warning: fix'1416.tex.out/fix'1416.gtmp was renamed to fix-14
16.tex.out/fix-1416.gtmp on input line 135
Module gregoriotex Warning: fix'1416.tex.out/fix'1416.test.gsnippet was renamed 
to fix-1416.tex.out/fix-1416.test.gsnippet on input line 135
Module gregoriotex Warning: fix'1416.tex.out/fix'1416.gsnippet was renamed to fi
x-1416.tex.out/fix-1416.gsnippet on input line 135
Module gregoriotex Warning: fix'1416.tex.out/fix'1416.gsniplog was renamed to fi
x-1416.tex.out/fix-1416.gsniplog on input line 135

As you can see in those warnings, the output directory is part of the protected filename and the renaming rules "fix" it. Either the testing program has to create a "safe" output directory or the renaming rules have to be made aware of the possibility of an output directory and not play with its name when making the file names "safe". I'm not sure at this point which is the better option and will have to study the problem when I'm not going to bed.

henryso commented 6 years ago

It's possible, I suppose, to alter the directory created for the output, but doesn't that indicate a potential issue when a user uses a directory with problematic characters in it?

henryso commented 6 years ago

I looked a bit at the lua code, and it makes me think that perhaps it would be better to quote/escape things in the command than to fiddle with the arguments. The difficulty with this is OS-compatibility, unless there is an explicit form of execution with explicit arguments.

rpspringuel commented 6 years ago

but doesn't that indicate a potential issue when a user uses a directory with problematic characters in it?

That's what has me vacillating on whether the solution should be changing the testing protocol or the program behavior. I need to do some testing as to what happens currently and with my proposed changes when the directory name contains a protected character.

henryso commented 6 years ago

Have you tried quoting the arguments? If it works, I think it would cover most of the cases. Should be compatible with both Posix and Windows. To wit:

l.150/156. local cmd = string.format([["%s" -o "%%s" "%s"]], real_gregorio_exe, test_snippet_filename) l.935. local cmd = string.format([["%s" -W %s-o "%%s" -l "%s" "%s"]], gregorio_exe(), deprecated, snippet_logname, snippet_filename)

rpspringuel commented 6 years ago

Trying that (after undoing the other changes I had made) works for the new test, but now I'm getting a bunch of the following errors:

gabc-output/bugs/fix-347.gabc : FAIL - Expectation missing for gabc-output/bugs/fix-347.gabc.out/fix-347/fix-347.tex

As you can see there's an extra level of directory introduced in the the path down which the testing program searches for the expectation. I'm not sure what might be causing that as it's only happening on 16 tests. I'm going to have to look more closely at those tests to see what they might have in common (and which is different from all the others) in order to figure out why they are having this issue.

henryso commented 6 years ago

That seems odd indeed. Let me see if I can figure out what's going on. It smells like a bug in the test harness implementation rather that in gregorio.

henryso commented 6 years ago

I ran the filenames branch of gregorio-test against the ctan branch of gregorio with only the modifications to the three lines above. I don't get the symptoms you get. The most likely possibilities that come to mind are (1) something I didn't commit (it doesn't look like it), (2) some incompatibility with the version of bash I'm using, or (3) an OS incompatibility.

my bash --version shows:

GNU bash, version 4.4.12(1)-release (x86_64-pc-linux-gnu)

What version are you using?

rpspringuel commented 6 years ago
GNU bash, version 4.4.23(1)-release (x86_64-apple-darwin17.5.0)

Looks like I have a more recent version, but only at a bug-fix level.

henryso commented 6 years ago

I'm unfortunately at a loss as to the problem. I think I have to depend on your ability to debug this.

henryso commented 6 years ago

Also, if there's any other information you can give me that might help me focus my efforts, that would be helpful. For example, what is the command you are using to invoke the tests?