Bug #9917
Fileset not ignoring case
100%
Related issues
History
#1 Updated by Roger Borrello about 1 year ago
- Related to Bug #9863: Fileset eXclude broken on native Windows added
#2 Updated by Roger Borrello about 1 year ago
Filesets are not finding files when case-insensitivity is true and -Z is used. This behaves in the same manner as file-cvt-list.txt when -F is used, although we aren't too concerned with that, since it is deprecated.
I have been debugging, and when FileListFactory.processFileSet creates a new ExplicitFileList reference = new ExplicitFileList(caseSens);, which is step 1 for the filelist, the FileList comparator is created, but subsequently is never used. It looks like it's is supposed to be used, to allow for ignoring case when filenames are compared. We never build a FileList because the first file listed in my zset_file.txt doesn't match in case:
ExplicitFileList l1 = new ExplicitFileList(new String[] { path });
String[] filenames = l1.listFilenames();
The
listImpl looks for actual files, and doesn't find them:
protected void listImpl(List<File> results)
{
// separate file and directory results
for (String filename : filenames)
{
File next = new File(filename);
if (next.exists() && next.isFile())
{
// add the file to the results list
results.add(next);
}
}
}
Somehow the compare method should be used to determine if the file exists in a case-insensitive manner.
#3 Updated by Roger Borrello about 1 year ago
Below is a recreate:
On Ubuntu, create ./abl/test.p (just message "Hello world!" and lowercase filename) and zfile_set.txt containing:
F ./abl/Test.p
Make sure to have the below in the
cfg/p2j.cfg.xml:
<parameter name="opsys" value="WIN32" />
<parameter name="winsys" value="MS-WINDOWS" />
<parameter name="case-sensitive" value="false" />
Attempt conversion:
java -classpath p2j/build/lib/p2j.jar com.goldencode.p2j.convert.ConversionDriver -ZId2 f2+m0+cb zfile_set.txt#4 Updated by Greg Shah about 1 year ago
- Related to Bug #7255: FWD resolves a OO file not included in conversion, if it exists on disk and on PROPATH added
#5 Updated by Greg Shah about 1 year ago
- Assignee set to Dănuț Filimon
#6 Updated by Dănuț Filimon about 1 year ago
- Status changed from New to Review
- % Done changed from 0 to 100
- reviewer Greg Shah added
I confirmed that the scenario doesn't work. About #9917-2, the compare method is not what I expect to use in this case because I would need to have a list of files already which only happens right after listImpl() is called. To fix it, we get all files from the parent directory then check if it exists - dirFile.getPath().equalsIgnoreCase(filename).
I created 9917a from latest trunk/15944 and committed the fix to revision 15945. I also added a Map<File, Map<String, File>> to map the parent directory to another map where the key will be the lowercased path and the value will be the actual file added to the results.
Greg, please review.
#7 Updated by Greg Shah about 1 year ago
- Status changed from Review to Internal Test
Code Review Task Branch 9917a Revision 15945
Please only initialize directoryCache when !isCaseSensitive() is true. That avoids construction of a map which is slighly expensive.
Otherwise the changes look good.
#8 Updated by Dănuț Filimon about 1 year ago
I committed 9917a/15946 to address #9917-7. I will do a few more tests.
#9 Updated by Dănuț Filimon about 1 year ago
I tested and didn't find a scenario where this breaks. The customer application I'm working on uses uses the default value (false), so I'll just convert that app.
ETF and ChUI projects use case-sensitive = true in p2j.cfg.xml.
#10 Updated by Dănuț Filimon about 1 year ago
I ran a conversion for a customer application that uses case-sensitive = false and it failed.
The scenario:- 7156e+9917a conversion only finds a class named (not the actual name):
ClassnameTestTest.java - Baseline conversion should the following two classes in the same folder:
ClassnameTestTest.javaandClassnameTesttest.java
The reproduction involves frames:
form "test1" with frame testform. form "test2" with frame test-form.and the project fails to compile:
compile:
[javac] Compiling 33 source files to /home/ddf/gcd/branches/hotel_gui/build/classes
[javac] Compiling 3 source files to /home/ddf/gcd/branches/hotel_gui/build/classes
[javac] /home/ddf/gcd/branches/hotel_gui/src/com/goldencode/hotel/Start.java:18: error: cannot find symbol
[javac] StartTestForm testFormFrame = GenericFrame.createFrame(StartTestForm.class, "test-form");
[javac] ^
[javac] symbol: class StartTestForm
[javac] location: class Start
[javac] /home/ddf/gcd/branches/hotel_gui/src/com/goldencode/hotel/Start.java:18: error: cannot find symbol
[javac] StartTestForm testFormFrame = GenericFrame.createFrame(StartTestForm.class, "test-form");
[javac] ^
[javac] symbol: class StartTestForm
[javac] location: class Start
[javac] 2 errors
BUILD FAILED
/home/ddf/gcd/branches/hotel_gui/build.xml:477: Compile failed; see the compiler error output for details.
Currently investigating.
#11 Updated by Dănuț Filimon about 1 year ago
I think the naming convention for frames should be changed. When handling a frame with the name test-form, the name will be TestForm (uppercasing the first letter and the letter after -), while testform will be a simple Testform (uppercasing the first letter).
#12 Updated by Dănuț Filimon about 1 year ago
- % Done changed from 100 to 90
- Status changed from Internal Test to WIP
Dănuț Filimon wrote:
I think the naming convention for frames should be changed. When handling a frame with the name
test-form, the name will be TestForm (uppercasing the first letter and the letter after-), whiletestformwill be a simpleTestform(uppercasing the first letter).
The frame name are obtained from NameConverterWorker.convert() call, from WorkArea.history I got the following:
./abl/start.p -> {ArrayList@352463} size = 4
values:
BLOCK Java variable testForm test-form
BLOCK Java class TestForm test-form
BLOCK Java variable testform testform
BLOCK Java class Testform testform
I am still thinking on how to approach this, maybe using a case insensitive hash map to store the converted names... But I am afraid this will affect performance.
#13 Updated by Dănuț Filimon about 1 year ago
=== modified file 'src/com/goldencode/p2j/convert/ConversionDriver.java'
--- old/src/com/goldencode/p2j/convert/ConversionDriver.java 2025-01-02 14:26:27 +0000
+++ new/src/com/goldencode/p2j/convert/ConversionDriver.java 2025-06-04 13:08:51 +0000
@@ -1095,7 +1095,7 @@
oldjasts.addAll(Arrays.asList(menus));
// save the results
- jasts = new ExplicitFileList(oldjasts.toArray(new String[0]));
+ jasts = new ExplicitFileList(oldjasts.toArray(new String[0]), true);
}
/**
This fixes the issue, but I've just found an issue.
Scenarios:- zfile_set.txt contains
F .abl/Start.p, then it is converted correctly. - zfile_set.txt contains
F .abl/start.p, then it converts ./abl/Start.p. I'd expect the right start.p to be selected here. What do you think Greg?
There are also 2 ./abl/start.p.jast entries in oldjasts when calling convertSourceNamesToJavaAstNames() in this case, this is because the source is using an ExplicitFileList with caseSens=false. I think that listImpl() should actually operate on a Set<File> instead of a List<File>.
#14 Updated by Roger Borrello about 1 year ago
Dănuț Filimon wrote:
[...]
This fixes the issue, but I've just found an issue.
Scenarios:
- zfile_set.txt contains
F .abl/Start.p, then it is converted correctly.- zfile_set.txt contains
F .abl/start.p, then it converts ./abl/Start.p. I'd expect the right start.p to be selected here. What do you think Greg?There are also 2 ./abl/start.p.jast entries in oldjasts when calling
convertSourceNamesToJavaAstNames()in this case, this is because the source is using an ExplicitFileList with caseSens=false. I think that listImpl() should actually operate on a Set<File> instead of a List<File>.
That is an impossible situation on a system such as Windows (having both start.p and Start.p). It really shouldn't happen when a project is handed over to us, but if it did, I don't think there's anything wrong with taking one that matches case-sensitively, otherwise just the first one if there isn't a case-sensitive match.
#15 Updated by Greg Shah about 1 year ago
I'd expect the right start.p to be selected here. What do you think Greg?
Yes. On a case-insensitive approach, only one can be present in the list. The first found should "win". Any other one should be ignored.
I think that listImpl() should actually operate on a Set<File> instead of a List<File>.
Agreed
#16 Updated by Dănuț Filimon about 1 year ago
I committed 9917a/15947. This only contains changes for the frame and menu issue, the idea is that in convertSourceNamesToJavaAstNames() we've already gotten the sources from a FileList that uses the configured case sensitive value, but frames and menus are not subjected to this property when being created. In this case, the ExplicitFileList should set caseSens to true.
As for the Set usage for listImpl, it comes with issues when sorting. I am not sure if using a TreeSet and removing the sortFiles entirely is ok because we have ExplicitFileList.sort being used in a few cases.
#17 Updated by Dănuț Filimon about 1 year ago
I rebased 9917a to latest trunk/15967, the branch is now at revision 15970.
I plan to commit the change for listImpl() today.
#18 Updated by Dănuț Filimon about 1 year ago
- Status changed from WIP to Review
- % Done changed from 90 to 100
Committed 9917a/14971. Use Set instead of List for listImpl() and sortFiles() + a few small changes.
#19 Updated by Dănuț Filimon about 1 year ago
I will be running a conversion today with the same customer application that failed previously.
#20 Updated by Dănuț Filimon about 1 year ago
Dănuț Filimon wrote:
I will be running a conversion today with the same customer application that failed previously.
Conversion was successful, I will need a review before I proceed with other tests.
#21 Updated by Greg Shah about 1 year ago
Code Review Task Branch 9917a Revisions 15969 through 15971
Overall, the changes seem reasonable.
My only question is why we hard code the case-sensitive flag to true in use of the ExplicitFileList constructor in ConversionDriver.convertSourceNamesToJavaAstNames(). That seems like it may bring unwanted behavior on systems with case-insensitive filessystems. Shouldn't that be driven by our configuration in p2j.cf.xml? If that isn't appropriate, then we probably need to fix the frame/menu issue in a different way.
#22 Updated by Dănuț Filimon about 1 year ago
Greg Shah wrote:
Code Review Task Branch 9917a Revisions 15969 through 15971
Overall, the changes seem reasonable.
My only question is why we hard code the case-sensitive flag to
truein use of theExplicitFileListconstructor inConversionDriver.convertSourceNamesToJavaAstNames(). That seems like it may bring unwanted behavior on systems with case-insensitive filessystems. Shouldn't that be driven by our configuration inp2j.cf.xml? If that isn't appropriate, then we probably need to fix the frame/menu issue in a different way.
The issue is that the already scanned in front(), while the ExplicitFileList in this case is created in back(). This means that the sources we have should not be affected. The problem is that we can't create an ExplicitFileList for frame and menu names that is case sensitive, but not case sensitive for the sources. For your information, this is no longer a problem in #7180 because the ArtifactCollection instances are merged as is and ExplicitFileList is not used.
#24 Updated by Dănuț Filimon about 1 year ago
There's a single customer application left to test to get 9917a into the merge queue and tomorrow I expect to get the conversion done.
#25 Updated by Dănuț Filimon about 1 year ago
The customer application converted, but the build failed. Some temp-table dmos were missing and might be caused by something else, so a new baseline will have to be converted because I used a newer trunk revision.
#26 Updated by Dănuț Filimon about 1 year ago
--- deleted, the comment was for another issue
#27 Updated by Dănuț Filimon about 1 year ago
Dănuț Filimon wrote:
The customer application converted, but the build failed. Some temp-table dmos were missing and might be caused by something else, so a new baseline will have to be converted because I used a newer trunk revision.
The conversion failed again. I thought that the problem is two temp-tables (tt-example and ttexample) being defined, but the problem looks to be something else. Andrei is currently running the conversion baseline for the application.
#28 Updated by Dănuț Filimon 12 months ago
- % Done changed from 100 to 90
- Status changed from Internal Test to WIP
There's definitely an issue with the 9917a changes, I got the sources/logs for the 9917a and trunk conversions. The plan is to compare the sources, then check the conversion log for the step where the issue appears.
#29 Updated by Dănuț Filimon 12 months ago
Generate Java Source Data Model Objects (DMOs) phase. The differences are like this (names replaced):
- 9917a
[java] ./app/dmo/_temp/Ttexample_1.java [java] ./app/dmo/_temp/TtSingleTable_1.java ... [java] ./app/dmo/_temp/TtTest_3.java [java] ./app/dmo/_temp/TtDemo_1.java ... [java] ./app/dmo/_temp/TtOther_2.java [java] ./app/dmo/_temp/TmpCheck_3_1.java ... [java] ./app/dmo/_temp/TtProblem_1.java [java] ./app/dmo/_temp/TtProblem_1_1.java [java] ./app/dmo/_temp/TmpNormal_1.java [java] ./app/dmo/_temp/TmpSimple_1.java - trunk
[java] ./app/dmo/_temp/Ttexample_1.java [java] ./app/dmo/_temp/Ttexample_1_1.java ... [java] ./app/dmo/_temp/TtTest_3.java [java] ./app/dmo/_temp/TtTest_3_1.java ... [java] ./app/dmo/_temp/TtOther_2.java [java] ./app/dmo/_temp/TtOther_2_1.java ... [java] ./app/dmo/_temp/TtProblem_1.java [java] ./app/dmo/_temp/TtProblem_1_1.java [java] ./app/dmo/_temp/Ttproblem_2.java [java] ./app/dmo/_temp/Ttproblem_2_1.java
./app/dmo/_temp/TtDemo_1.javais replaced by[java] ./app/dmo/_temp/TtTest_3_1.javain trunk, but when checking the 9917a log, the./app/dmo/_temp/TtDemo_1.javaappears two times which is wrong.- Main problem lies in
[java] ./app/dmo/_temp/TtProblem_1.java [java] ./app/dmo/_temp/TtProblem_1_1.java [java] ./app/dmo/_temp/Ttproblem_2.java [java] ./app/dmo/_temp/Ttproblem_2_1.javawhere the same table appears.
#31 Updated by Dănuț Filimon 12 months ago
#32 Updated by Dănuț Filimon 12 months ago
- TtExample_2.java and TtExample2_1.java
- Ttexample_1.java and Ttexample1_1.java
#33 Updated by Dănuț Filimon 12 months ago
I will revert the Set changes and see if the problem persists. If this is the cause, I will create a separate issue to work on replacing the List with Set.
#34 Updated by Dănuț Filimon 11 months ago
- % Done changed from 90 to 100
- Status changed from WIP to Internal Test
I retested conversion without revision 15971 for the problematic application and there were no issues.
Committed 9917a/15972, reverted revision 15971. Rebased 9917a to latest trunk/16123, the branch is now at revision 16128. Committed 9917a/16129 to add history entries.
There's no need for a review since the last commit was not part of the fix for this issue and was only something nice to have, I'll go straight to testing! :)
#35 Updated by Dănuț Filimon 11 months ago
The regression test plan passed with 9917a, the branch can be merged.
#37 Updated by Alexandru Lungu 11 months ago
I prefer to defer the merging after customer deliveries happening tomorrow evening.
#38 Updated by Alexandru Lungu 11 months ago
- Status changed from Internal Test to Merge Pending
Danut, please merge 9917a to trunk after 10020a. There won't be any delivery this week - the next scheduled delivery is next week.
#39 Updated by Alexandru Lungu 11 months ago
Alexandru Lungu wrote:
Danut, please merge 9917a to trunk after 10020a. There won't be any delivery this week - the next scheduled delivery is next week.
Danut, you can merge now.
#40 Updated by Dănuț Filimon 11 months ago
- Status changed from Merge Pending to Test
- version_resolved set to trunk/16139
Branch 9917a was merged into trunk as revision 16139 and archived.
#41 Updated by Dănuț Filimon 10 months ago
- Related to Bug #10626: DMO names can collide on case-insensitive file-system added