hoijui / Jawk

Java AWK interpreter/compiler
GNU General Public License v3.0
39 stars 23 forks source link

compile error if (escaped) slash in regular expression #4

Closed jannick0 closed 8 years ago

jannick0 commented 8 years ago

Hi,

very interesting project this is! Testing around I bumped into a jawk compilation issue when invoking a regular expression in a pattern containing a slash.

/\// { print }

While being complete newbie to the whole java world for a couple of days now, this error occured both with jawk.1_02.jar (which might be a bit outdated right now) and the compiled master branch as of now. Not sure if this is a bug or rather some error here on my side. Any help on that highly appreciated.

Separately, for compiling the master branch I needed to make two adjustments:

  1. Suppressing tests since three tests failed.
  2. Inserting an empty <relativePath></relativePath> element to <parent>...</parent> to avoid that some other stuff is used.

Happy to provide any more information if needed or running tests.

Thx!

hoijui commented 8 years ago

it works for me with this command:

#mvn package
java -jar target/jawk-1.03-SNAPSHOT-stand-alone.jar "/\// { print }" testInputFile.txt

this should have been fixed by commit https://github.com/hoijui/Jawk/commit/40569a69698fc7c4768168a343f8065fcfac8728.

are you sure you are testing with hoijui/master? or is it maybe stonewell/master?

about the second thing (<relativePath></relativePath>), i am not sure what you mean, or why you need that, but it sounds like a hack.. can you explain? is it related to some special local configuration only you have?

thanks for the report, and even in such a friendly fashion! :-)

jannick0 commented 8 years ago

Thanks - likewise - and many thanks for coming back very quickly.

I redid the git clone and build, and now slashes are properly processed in patterns. Great, thanks for your hint.

However, three tests still fail why I run mvn -Dmaven.test.skip=true package. Here maven' complaints:

Tests run: 7, Failures: 3, Errors: 0, Skipped: 1, Time elapsed: 0.466 sec <<< FAILURE! - in org.jawk.AwkTest
testTwoRules(org.jawk.AwkTest)  Time elapsed: 0.35 sec  <<< FAILURE!
java.lang.AssertionError: array lengths differed, expected.length=7 actual.length=3
        at org.jawk.AwkTest.testTwoRules(AwkTest.java:121)

testMailListLiList(org.jawk.AwkTest)  Time elapsed: 0.016 sec  <<< FAILURE!
java.lang.AssertionError: array lengths differed, expected.length=4 actual.length=1
        at org.jawk.AwkTest.testMailListLiList(AwkTest.java:107)

testEmptyPattern(org.jawk.AwkTest)  Time elapsed: 0.006 sec  <<< FAILURE!
java.lang.AssertionError: array lengths differed, expected.length=17 actual.length=1
        at org.jawk.AwkTest.testEmptyPattern(AwkTest.java:135)

Do you need any more information on that - or is that not confusing enough to dig into further? Happy to stay on deck.

To the second thing: mvn package runs some tests first with the prompted warning

[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for org.jawk:jawk:bundle:1.03-SNAPSHOT
[WARNING] 'parent.relativePath' of POM org.jawk:jawk:1.03-SNAPSHOT (C:\...\svn\Jawk\pom.xml) points at some.other.path instead of org.sonatype.oss:oss-parent, please verify your project structure @ line 14, column 10
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]

It is solved by this </relativePath> trick (incl reference to the relevant documentation). I was guessing that this was not an evil hackery, but, of course, I am open for other solutions.

I am currently running some of my (g)awk scripts against jawk where I rely on some gawk specific features, e.g.

Would the implementation of the BEGINFILE/ENDFILE feature be a request to think about? I guess that the additonal string functions could be separatedly covered by some auxiliary .java code. I would be interested in how you would tackle these two things.

Many thanks again!

hoijui commented 8 years ago

i do not get any failed tests with mvn test. which commit are you on exactly?

i accidentally figured out that the new way (already since quite some time) to use sontaype to publish to maven central, works differently, and does not involve using a sonatype supplied parent anymore.. converting to the new way will surely fix this problem.. will do that.. thanks! :-) better to let the warning there as a reminder, then hiding the actual issue, until it is fixed.

to implement new functionality... actually, i am more a kind of very passive maintainer of JAWK, then something like a proper main-dev. all i ever did was maintain it, clean it up a bit.. and i am totally not into the code-base. in other words, i would not know where to start, or how much work it would be, and i am into too much other stuff already to start this. i'd be glad to review patches of course! :-)

jannick0 commented 8 years ago

I am living on a Windows system. Test runs are fine now after line ending conversion of the test input files to Windows style. For reference github's guidance on how to deal with line endings.

The maven warning I will tacitly ignore that then. :)

Functionality - Understood. After a deeper look into the jawk package:

I close this issue now - I hope this is fine with you. Many thanks again.