Project

General

Profile

Bug #10313

server-sidef file-system must 'mount' user's working dir and look in this path by default

Added by Constantin Asofiei about 1 year ago. Updated 4 months ago.

Status:
Test
Priority:
Urgent
Target version:
-
Start date:
Due date:
% Done:

100%

billable:
No
vendor_id:
GCD
case_num:
version_reported:
version_resolved:
production:
No
env_name:
topics:

Related issues

Related to User Interface - Feature #9055: server-side processing of client platform dependencies in the UI Closed

History

#1 Updated by Constantin Asofiei about 1 year ago

  • Related to Feature #9055: server-side processing of client platform dependencies in the UI added

#3 Updated by Constantin Asofiei about 1 year ago

With server-side resources, all paths are relative to the FWD server's JVM working dir, and not the working directory specified in directory.xml for that FWD account.

We need to use this folder as the first one when doing propath, file-info:file-name, icon, etc lookups.

Artur, do you want to work on this?

#4 Updated by Artur Școlnic about 1 year ago

Constantin Asofiei wrote:

Artur, do you want to work on this?

Sure.

#5 Updated by Constantin Asofiei about 1 year ago

  • Assignee set to Artur Școlnic

#6 Updated by Artur Școlnic about 1 year ago

  • Status changed from New to WIP

As far as I can understand the current dir . should be resolved to the workingDir defined in the directory.xml. I think mounting the . to in Utils.setPathMap could do the trick. The problem is that it is called only when the legacy OS is different from the current runtime OS, which is not the case usually.

#7 Updated by Constantin Asofiei about 1 year ago

Yes, but don't rely on '.' to be first in the path. Any relative path should resolve to workingDir first, and after that other places (although here there may be a security issue - do we allow JVM working dir resolution of files?).

legacy-system/absolute-path-prefix-map is used to re-map absolute paths, so I can't tell how easy is to use that support.

#8 Updated by Artur Școlnic 12 months ago

  • Status changed from WIP to Review
  • reviewer Constantin Asofiei added

I think I found an easier way, the code is in 10313a/16065.
The test cases I am working with are:


FILE-INFO:FILE-NAME = ".". 

message FILE-INFO:FULL-PATHNAME. //should be the user defined workingDir
message FILE-INFO:FILE-TYPE.
message FILE-INFO:FILE-MOD-DATE.
message FILE-INFO:FILE-SIZE.

FILE-INFO:FILE-NAME = "test.txt".

IF FILE-INFO:FULL-PATHNAME <> ? THEN
  MESSAGE "Test 1: OK - found:" FILE-INFO:FULL-PATHNAME
    VIEW-AS ALERT-BOX.
ELSE
  MESSAGE "Test 1: FAIL - file not found" 
    VIEW-AS ALERT-BOX ERROR.

FILE-INFO:FILE-NAME = "pkg/data.xml".

IF FILE-INFO:FULL-PATHNAME <> ? THEN
  MESSAGE "Test 2: OK - found:" FILE-INFO:FULL-PATHNAME
    VIEW-AS ALERT-BOX.
ELSE
  MESSAGE "Test 2: FAIL - file not found" 
    VIEW-AS ALERT-BOX ERROR.

FILE-INFO:FILE-NAME = "pkg/../test.txt".

IF FILE-INFO:FULL-PATHNAME <> ? THEN
  MESSAGE "Test 3: OK - found:" FILE-INFO:FULL-PATHNAME
    VIEW-AS ALERT-BOX.
ELSE
  MESSAGE "Test 3: FAIL - file not found" 
    VIEW-AS ALERT-BOX ERROR.

FILE-INFO:FILE-NAME = "nonexistent-file.txt".

IF FILE-INFO:FULL-PATHNAME = ? THEN
  MESSAGE "Test 4: OK - file correctly not found" 
    VIEW-AS ALERT-BOX.
ELSE
  MESSAGE "Test 4: FAIL - file was found but shouldn't be" 
    VIEW-AS ALERT-BOX ERROR.

FILE-INFO:FILE-NAME = "pkg\\DATA.XML".

IF FILE-INFO:FULL-PATHNAME <> ? THEN
  MESSAGE "Test 5: OK - found (mixed/case):" FILE-INFO:FULL-PATHNAME
    VIEW-AS ALERT-BOX.
ELSE
  MESSAGE "Test 5: FAIL - not found (mixed/case)" 
    VIEW-AS ALERT-BOX ERROR.

DEFINE VARIABLE absPath AS CHARACTER NO-UNDO.
absPath = "/home/as/test.txt".

FILE-INFO:FILE-NAME = absPath.

IF FILE-INFO:FULL-PATHNAME <> ? THEN
  MESSAGE "Test 6: OK - found absolute:" FILE-INFO:FULL-PATHNAME
    VIEW-AS ALERT-BOX.
ELSE
  MESSAGE "Test 6: FAIL - absolute path not resolved" 
    VIEW-AS ALERT-BOX ERROR.

With the changes, the test cases pass.

#9 Updated by Constantin Asofiei 12 months ago

Artur, please check in initFileInfo that the given name is not an absolute name first. If this is the case, then working dir should not be looked. You can end up with cases when the name is /foo/bar and the working dir also has /path/to/workDir/foo/bar, while it exists on disk as /foo/bar.

Also, the change in getWorkingDirectory is not correct. When server-side filesystem is not used, this needs to return the working dir for the FWD Client JVM. Keep in mind that clientConfig/workingDir is optional.

#10 Updated by Artur Școlnic 12 months ago

  • Status changed from Review to WIP

#11 Updated by Artur Școlnic 12 months ago

Constantin Asofiei wrote:

Artur, please check in initFileInfo that the given name is not an absolute name first. If this is the case, then working dir should not be looked. You can end up with cases when the name is /foo/bar and the working dir also has /path/to/workDir/foo/bar, while it exists on disk as /foo/bar.

Yes, this is a compromise, I am not sure how to check if a path is absolute, like you mentioned, a path can be both absolute and relative. In initFileInfo we only have the path string.

#12 Updated by Constantin Asofiei 12 months ago

Can't File.isAbsolute work?

#13 Updated by Artur Școlnic 12 months ago

It does :) I also found now that Paths.get(name).isAbsolute() works, I am wrapping up the changes.

#14 Updated by Artur Școlnic 12 months ago

  • Status changed from WIP to Review

Committed the changes to 10313a/16066, please review.

#15 Updated by Constantin Asofiei 12 months ago

Artur, for 10313a:
  • getWorkingDirectory().value.concat("/").concat(name); - does this work on Windows? Don't we need to append OS path separator?
  • wa.info = wa.fs.accessFileInfo(origName); - this doesn't consider if origName is null (previously it did)

#16 Updated by Constantin Asofiei 12 months ago

Also, we need to test the impact on customer projects where server-side filesystem is used.

#17 Updated by Artur Școlnic 12 months ago

I addressed the review.
Constantin, please email me the testing that has to be done.

#18 Updated by Constantin Asofiei 12 months ago

  • % Done changed from 0 to 100
  • Status changed from Review to Internal Test

I'm OK with the change. Any more testing needed?

#19 Updated by Artur Școlnic 12 months ago

Only the large gui application has been tested, I have not seen server side fs being used in other projects.

#20 Updated by Constantin Asofiei 12 months ago

Question: did you test the propath lookup, also? Usually there are a '.' or relative paths there, and this means 'current working dir'.

#21 Updated by Artur Școlnic 12 months ago

I only used the tests in note 8.

#22 Updated by Constantin Asofiei 12 months ago

  • Status changed from Internal Test to WIP
  • % Done changed from 100 to 60

Please go ahead and create tests for PROPATH, icons and other features which load from the file-system.

#23 Updated by Artur Școlnic 12 months ago

Do you mean something like this:

PROPATH = ENTRY(1,PROPATH) + "/prop".

FILE-INFO:FILE-NAME = "test.txt".

IF FILE-INFO:FULL-PATHNAME <> ? THEN
  MESSAGE "Test 1: OK - found:" FILE-INFO:FULL-PATHNAME
    VIEW-AS ALERT-BOX.
ELSE
  MESSAGE "Test 1: FAIL - file not found" 
    VIEW-AS ALERT-BOX ERROR.

test.txt exists both in prop and working dir defined by the user, the file should be found in the working dir, because it has the priority.

#24 Updated by Constantin Asofiei 12 months ago

I mean more like setting an icon for a button (for which the location uses PROPATH AFAIK), or using a COPY-LOB (with files as source/target) or even a INPUT FROM or OUTPUT TO statement. All these can work with the server-side file-system, and they must be relative to the agent's workingDir in PASOE, if the path is relative.

Greg: in terms of #9055, I think there is more than what we can identify easily. We can release 10313a, and after that figure out all features which require file-system access.

#25 Updated by Artur Școlnic 12 months ago

message CURRENT-WINDOW:LOAD-ICON("icon.ico").
message CURRENT-WINDOW:LOAD-ICON("./icon.ico").
message CURRENT-WINDOW:LOAD-ICON("pkg/icon.ico").
message CURRENT-WINDOW:LOAD-ICON("./pkg/icon.ico").

DEFINE VARIABLE dInFile    AS CHAR  NO-UNDO INIT "./test.txt".  
DEFINE VARIABLE dataMemptr AS MEMPTR NO-UNDO. 
COPY-LOB FROM FILE dInFile TO dataMemptr. 

DEFINE VARIABLE dInFile2    AS CHAR  NO-UNDO INIT "test.txt".  
DEFINE VARIABLE dataMemptr2 AS MEMPTR NO-UNDO. 
COPY-LOB FROM FILE dInFile2 TO dataMemptr2. 

DEFINE VARIABLE dInFile3    AS CHAR  NO-UNDO INIT "pkg/test.txt".  
DEFINE VARIABLE dataMemptr3 AS MEMPTR NO-UNDO. 
COPY-LOB FROM FILE dInFile3 TO dataMemptr3.

DEFINE VARIABLE dInFile4    AS CHAR  NO-UNDO INIT "./pkg/test.txt".  
DEFINE VARIABLE dataMemptr4 AS MEMPTR NO-UNDO. 
COPY-LOB FROM FILE dInFile4 TO dataMemptr4.

INPUT FROM VALUE("test.txt").
INPUT CLOSE.

INPUT FROM VALUE("./test.txt").
INPUT CLOSE.

INPUT FROM VALUE("pkg/test.txt").
INPUT CLOSE.

INPUT FROM VALUE("./pkg/test.txt").
INPUT CLOSE.

OUTPUT TO VALUE("testOut.txt").
INPUT CLOSE.

OUTPUT TO VALUE("./testOut2.txt").
INPUT CLOSE.

OUTPUT TO VALUE("pkg/testOut.txt").
INPUT CLOSE.

OUTPUT TO VALUE("./pkg/testOut2.txt").
INPUT CLOSE.

The tests fail because the methods do not use initFileInfo.

Constantin, do we need to go through all the methods and functions that could take a relative path as an argument and add workig dir resolving to them?

#26 Updated by Constantin Asofiei 12 months ago

Artur Școlnic wrote:

Constantin, do we need to go through all the methods and functions that could take a relative path as an argument and add workig dir resolving to them?

Yes, make a list of the statements we need to test. There is also COPY-LOB TO file

#27 Updated by Artur Școlnic 12 months ago

Isn't there a place where all relative file names are resolved to the current working dir? Without server-side fs, all these methods do work correctly, they are resolving the path to the actual current working dir.

#28 Updated by Constantin Asofiei 12 months ago

There is TargetData and SourceData, which in the end rely on StreamFactory.openFileStream

For icons, there is TC.loadWindowIcon and loadImage, which rely on searchPathWithExts and searchPath in FileSystemDaemon.

I can't tell what other location would be, look for references of FileInputStream and other APIs which load from file-system.

#29 Updated by Artur Școlnic 12 months ago

I was hoping for a single method or class where all the lookups are performed :)

#30 Updated by Artur Școlnic 12 months ago

Eventually any relative path should be prefixed with the OS working dir or PROPATH. Maybe we can just add an entry to the PROPATH (at the front) with the client working dir.

#31 Updated by Artur Școlnic 12 months ago

It's a long shot, but:

cd ../work/ && ../client/client.sh

Effectively sets the user.dir to any path we choose, thus simulating a custom working dir :)

#32 Updated by Constantin Asofiei 12 months ago

Artur Școlnic wrote:

It's a long shot, but:
[...]

Effectively sets the user.dir to any path we choose, thus simulating a custom working dir :)

Well, you can't do that in PASOE :) there is no FWD client there, just the FWD server JVM. And with server-side file-system, the 'user.dir' is the FWD Server's working dir.

#33 Updated by Artur Școlnic 12 months ago

Is the PROPATH always used in relative path resolving? If so, can't we just add the client working dir in the front of the PROPATH, thus all relative paths will be resolved using it first?

#34 Updated by Constantin Asofiei 12 months ago

Artur Școlnic wrote:

Is the PROPATH always used in relative path resolving? If so, can't we just add the client working dir in the front of the PROPATH, thus all relative paths will be resolved using it first?

You can do that in searchPath and searchPathWithExts, but not change the actual PROPATH - this can be interpreted/managed by the application. And also this can be done only if you have i.e. "." or other relative paths in the PROPATH. You can't just change everything. And also keep in mind the entries in the PROPATH are also paths relative to name_map.xml, so not everything is a OS relative path.

Better said: when doing a PROPATH lookup, if the entry is a relative path, append the working dir for that context, for server-side filesystem.

#35 Updated by Greg Shah 12 months ago

Greg: in terms of #9055, I think there is more than what we can identify easily. We can release 10313a, and after that figure out all features which require file-system access.

I've OK with merging before all cases are worked so that the customer can do some testing. My sense is that these are very common features and the resulting system will be broken until all of the relative server-side file system usage is fixed.

SO: yes, merge quickly but no, don't defer the work.

#36 Updated by Greg Shah 12 months ago

Artur Școlnic wrote:

Isn't there a place where all relative file names are resolved to the current working dir? Without server-side fs, all these methods do work correctly, they are resolving the path to the actual current working dir.

I think we need to create such a thing and make it used everywhere. On a client-side process, it would use the actual current-directory the way it does now.

#37 Updated by Artur Școlnic 12 months ago

Extended the support for load-icon, copy-lob, input/output in 10313a/16068. Now the test cases from note 25 are passing.

#38 Updated by Artur Școlnic 12 months ago

Greg Shah wrote:

I think we need to create such a thing and make it used everywhere. On a client-side process, it would use the actual current-directory the way it does now.

My latest changes and the ones I plan to make here, are using FileSystemOps.searchPath everywhere a path is used to find or create resources, I think this method is a good candidate for a single point of entry for path look-ups throughout the project. Since it seems like we will have to scan the project and add support for working dir resolving, might as well do it using the same method.

#39 Updated by Constantin Asofiei 12 months ago

Artur, about 10313a rev 16068:
  • searchPath
    • will return the same relative path, not absolute. I don't know if that will help.
    • searchPath - this if (wa.serverSideFs && !Paths.get(filename).isAbsolute()) will append working dir even if that is a convert program name. What will SEARCH("a.p") return?
  • searchResourceJars - what if extensions is not null?

Focus on the SEARCH function and other non-UI statements for now please.

#40 Updated by Artur Școlnic 12 months ago

Constantin Asofiei wrote:

  • searchPath
    • will return the same relative path, not absolute.

Do you mean in non server-side fs?

  • What will SEARCH("a.p") return?

It will return the full path relative to the working dir, if it is in the working dir.

#41 Updated by Artur Școlnic 12 months ago

Constantin Asofiei wrote:

  • searchResourceJars - what if extensions is not null?

If the filename does not have the extension, the file will be resolved to the working dir, if it does have an extension and extensions is not null, the method will fail to find the file, same as before the changes, I think.

#42 Updated by Constantin Asofiei 12 months ago

Artur, there are still concerns:
  • in FileSystemOps.initFileInfo - why origName.isEmpty()?
          // If the first lookup failed, try again with the user.dir
          if(origName != null && origName.isEmpty() && (wa.info == null || wa.info.pathname == null))
          {
             wa.info = wa.fs.accessFileInfo(origName);
          }
    
  • in FileSystemOps.searchPath - filename.startsWith("./") is not OS-independent
  • searchResourceJars - that always uses relative filenames (I think to root package); this code can't be here:
          WorkArea wa = work.obtain();
          if (wa.serverSideFs && !Paths.get(filename).isAbsolute())
          {
             filename = getWorkingDirectory().value.concat(getFileSeparator()).concat(filename);
          }
    
    

#43 Updated by Constantin Asofiei 12 months ago

  • FileSystemDaemon.searchPathWithExts - the javadoc says that this also does PROPATH lookups - but I can't find where this would be done. If the javadoc is right, doing filename = getWorkingDirectory().concat(getFileSeparator()).concat(filename); will not allow looking up paths in the propath.

#44 Updated by Artur Școlnic 12 months ago

Constantin Asofiei wrote:

  • FileSystemDaemon.searchPathWithExts - the javadoc says that this also does PROPATH lookups - but I can't find where this would be done.
    * Search the current directory (and PROPATH if it is configured) for a given filename
    * with the specified extensions. 

I included this change here because the javadoc states that the search is done against the current dir first, in my mind that is the user.dir, so for server-side it should be the defined working dir. The propath lookup is a secondary choice, and remains so after the changes.

#45 Updated by Artur Școlnic 12 months ago

I addressed the issues from note 42. I tested the customer project with 9055, 10313a an PASOE, harness and webui navigation was ok.

#46 Updated by Artur Școlnic 11 months ago

Constantin, is there something else we should address at this point?

#47 Updated by Eric Faulhaber 11 months ago

  • Priority changed from Normal to Urgent

#48 Updated by Constantin Asofiei 11 months ago

Artur Școlnic wrote:

Constantin, is there something else we should address at this point?

I think if we fix TargetLob the append working dir to the filename if this is a relative path, we are OK.

#49 Updated by Artur Școlnic 11 months ago

I added these tests to the suite:

DEFINE VARIABLE dOutFile AS CHAR  NO-UNDO INIT "./test_out.txt".  
COPY-LOB FROM FILE dInFile TO FILE dOutFile. 

DEFINE VARIABLE dOutFile2 AS CHAR  NO-UNDO INIT "test_out2.txt". 
COPY-LOB FROM FILE dInFile2 TO FILE dOutFile2. 

DEFINE VARIABLE dOutFile3 AS CHAR  NO-UNDO INIT "pkg/test_out.txt".  
COPY-LOB FROM FILE dInFile3 TO FILE dOutFile3.

DEFINE VARIABLE dOutFile4 AS CHAR  NO-UNDO INIT "./pkg/test_out2.txt".
COPY-LOB FROM FILE dInFile4 TO FILE dOutFile4.

They work as expected, the output files are created in the defined working dir.

#50 Updated by Constantin Asofiei 11 months ago

Are they created in the working dir of the FWD client, when server-side resources are present?

#51 Updated by Artur Școlnic 11 months ago

Constantin Asofiei wrote:

Are they created in the working dir of the FWD client, when server-side resources are present?

Yes.
On another note:

wa.serverSideFs = OSResourceManager.getInstance().isServerSide(OsResourceType.FILESYSTEM);

is true even if i don't have the server-side enabled in the directory, is that expected?

#52 Updated by Constantin Asofiei 11 months ago

Artur Școlnic wrote:

Constantin Asofiei wrote:

Are they created in the working dir of the FWD client, when server-side resources are present?

Yes.
On another note:
[...]
is true even if i don't have the server-side enabled in the directory, is that expected?

If you are running in full PASOE, then yes.

#53 Updated by Artur Școlnic 11 months ago

I don't think I am , it is a dataset project with a standard directory. What is a sure way to check?

#54 Updated by Artur Școlnic 11 months ago

Assuming that the wa.serverSideFs is set correctly, the changes are fine. Constantin, I already tested a customer project with full pasoe and 10313a on linux, I intend to test on windows also, is there something else that should be tested?

#55 Updated by Artur Școlnic 11 months ago

There is an issue with the windows project

java.lang.NullPointerException
    at com.goldencode.p2j.ui.chui.ThinClient.switchWorker(ThinClient.java:20785)
    at com.goldencode.p2j.ui.chui.ThinClient.redirectOutput(ThinClient.java:20446)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    at java.base/java.lang.reflect.Method.invoke(Method.java:580)

at the appservers start.
Could be a directory or setup issue.

#56 Updated by Artur Școlnic 11 months ago

It was a directory issue. With full PASOE on both linux and windows 10313a passed the testing. There is a minor problem in a customer project, but it is present in trunk also, we should defer it to another task.

#57 Updated by Artur Școlnic 11 months ago

  • Status changed from WIP to Internal Test

#58 Updated by Artur Școlnic 11 months ago

Artur Școlnic wrote:

There is a minor problem in a customer project, but it is present in trunk

On every other 5-7 login a method is invoked which is not in the procedure (.p file) in the handle passed as argument to the invoke.
this is the stack trace

at com.goldencode.p2j.util.ControlFlowOps$InternalResolver.resolve(ControlFlowOps.java:11441)
at com.goldencode.p2j.util.ControlFlowOps$Resolver.resolve(ControlFlowOps.java:11416)
at com.goldencode.p2j.util.ControlFlowOps.invokeImpl(ControlFlowOps.java:7426)
at com.goldencode.p2j.util.ControlFlowOps.invoke(ControlFlowOps.java:4576)
at com.goldencode.p2j.util.appserver.CoreAppserver.invokeImpl(CoreAppserver.java:628)
at com.goldencode.p2j.util.appserver.CoreAppserver.lambda$invoke$2(CoreAppserver.java:281)
at com.goldencode.p2j.util.appserver.CoreAppserver$$Lambda$2131/0x000078bc018ad768.get(Unknown Source:-1)
at com.goldencode.p2j.util.appserver.CoreAppserver.executeScoped(CoreAppserver.java:1692)
at com.goldencode.p2j.util.appserver.CoreAppserver.invoke(CoreAppserver.java:279)
at com.goldencode.p2j.util.appserver.MultiSessionAppserverManager.lambda$invoke$13(MultiSessionAppserverManager.java:1400)
at com.goldencode.p2j.util.appserver.MultiSessionAppserverManager$$Lambda$1789/0x000078bc0183dde0.run(Unknown Source:-1)
at com.goldencode.p2j.util.appserver.MultiSessionAppserver$3.coreRun(MultiSessionAppserver.java:793)
at com.goldencode.p2j.util.appserver.MultiSessionAppserver$MsaTask.run(MultiSessionAppserver.java:2654)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
at java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.lang.Thread.run(Thread.java:840)
at com.goldencode.p2j.util.appserver.MultiSessionAppserver$MsaThread.run(MultiSessionAppserver.java:2417)

It is not quite clear to me where does the method name and procedure handle come from, adding to the complexity of the problem is the non deterministic nature.
Using the classic mode, this call does not happen at all.

#59 Updated by Artur Școlnic 11 months ago

Constantin, is there a chance that with PASOE, new pieces of code are being accessed in the customer project and the invoke is simply incorrect?

#60 Updated by Constantin Asofiei 11 months ago

Please create a task in the customer's project to discuss this.

10313a will not be delayed for this bug.

#61 Updated by Artur Școlnic 11 months ago

I tested harness+webui navigation on linux and windows, it passed.
I also asked my colleagues to test the branch with other projects, we should have the results tomorrow.

#62 Updated by Razvan-Nicolae Chichirau 11 months ago

A regression was found on another customer app. Testcase:

define var existentFile as char initial "/dev/null". 

FILE-INFO:FILE-NAME = existentFile.
FILE-INFO:FILE-NAME = "nonExistentFile".

message FILE-INFO:FULL-PATHNAME. // should be ?, but is /dev/null

For 10313a, on the second FILE-INFO:FILE-NAME, wa.info = wa.fs.accessFileInfo(origName) is skipped because:
  1. // try to look up the file using the user defined working dir first
    // when server side file system is on and the path is relative
    if (wa.serverSideFs && !Paths.get(name).isAbsolute())
    {
       name = getWorkingDirectory().value.concat(getFileSeparator()).concat(name);
       wa.info = wa.fs.accessFileInfo(name);
    }

    wa.serverSideFs is false.
  2. // If the first lookup failed, try again with the user.dir
    if(origName != null && !origName.isEmpty() && (wa.info == null || wa.info.pathname == null))
    {
       wa.info = wa.fs.accessFileInfo(origName);
    }

    wa.info.pathname contains the path from the first FILE-INFO:FILE-NAME.

#63 Updated by Artur Școlnic 11 months ago

Thank you for the testing and the test case, Razvan.
Constantin, I added a check for the previously computed file info name, looks like in some cases the pathname is stored and messes up the current call.
We will continue with the testing.

#64 Updated by Razvan-Nicolae Chichirau 11 months ago

The latest revision solved the original issue, but now I've detected another regression related to another changes. Please check this testcase:

define var windowsStyleAbsolutePath as char initial "\home\test.csv".
define stream testStream.

OUTPUT STREAM testStream TO VALUE(windowsStyleAbsolutePath).
OUTPUT STREAM testStream CLOSE.

You added in StreamFactory.openFileStream():

if (filename != null && !Paths.get(filename).isAbsolute())
{
   if (write)
   {
      filename = FileSystemOps.getWorkingDirectory().value.concat(getFileSeparator()).concat(filename);
   }
   else
   {
      filename = FileSystemOps.searchPath(filename).toStringMessage();
   }
}

The path is absolute, but is not UNIX-style. The resolving of this path will be made on the client later, through FileSystemDaemon.openFileStream with resolvePathName which will switch the path separators with File.separator, or /. As such, the code will add an unwanted working directory to the path.

#65 Updated by Artur Școlnic 11 months ago

It looks like I forgot to enable the working dir resolving only for server-size fs, I fixed that and asked Razvan to test again.

#66 Updated by Razvan-Nicolae Chichirau 11 months ago

No regressions found with rev. 16131.

#67 Updated by Artur Școlnic 11 months ago

Thank you, Razvan.

#68 Updated by Lorian Sandu 11 months ago

Large GUI app unittests passed!

#69 Updated by Artur Școlnic 11 months ago

Chui regression tests passed.
FwdTests passed.
Constantin, I think we can merge.

#70 Updated by Constantin Asofiei 11 months ago

  • Status changed from Internal Test to Merge Pending

Go ahead and merge now.

#71 Updated by Artur Școlnic 11 months ago

10313a was merged as rev 16125.

#72 Updated by Alexandru Lungu 11 months ago

  • Status changed from Merge Pending to Test

#73 Updated by Artur Școlnic 5 months ago

  • % Done changed from 60 to 100

#74 Updated by Artur Școlnic 5 months ago

  • Status changed from Test to WIP
  • % Done changed from 100 to 90

Input streams for files opened using a relative path fails with server-side resources

This is the test case:

def stream s-in.

procedure proc:
    define input parameter file_name as char.

    input stream s-in from value(file_name).
    input stream s-in close.

    DEFINE VARIABLE lcText AS LONGCHAR NO-UNDO.
    COPY-LOB FROM FILE file_name TO lcText.

    INPUT FROM VALUE(file_name).
    input close.
end.

run proc("file.txt").
run proc("../file.txt").
run proc("../work/file.txt").
run proc("./file.txt").
run proc("/home/as/projects/dataset/deploy/work/file.txt").

Prerequisites:
  • Working dir set as /home/$user/projects/dataset/deploy/work.
  • A file file.txt in work and deploy
  • Server-side resources enabled using
    <node class="container" name="standard">
            <node class="container" name="runtime">
              <node class="container" name="default">
                <node class="string" name="server-side-resources">
                  <node-attribute name="value" value="filesystem,streams,environments"/>
                </node>
    

All the relative paths are not resolved and the COPY-LOB operation assigns ? to the argument path.

#75 Updated by Artur Școlnic 5 months ago

  • Status changed from WIP to Review

Constantin, I committed the fix to 10313b, please review.

#76 Updated by Constantin Asofiei 5 months ago

  • Status changed from Review to WIP

#77 Updated by Constantin Asofiei 5 months ago

  • Status changed from WIP to Review
  • % Done changed from 90 to 100

Artur, please find where and why we used filename = FileSystemOps.searchPath(filename);.

#78 Updated by Artur Școlnic 5 months ago

  • % Done changed from 100 to 90

#79 Updated by Artur Școlnic 5 months ago

I checked the OE documentation for PASOE and did some experiments, the conclusion is:
  • PROPATH: used to find ABL code and classes exclusively.
  • Working directory (CWD / workDir): used to resolve relative file paths exclusively.
  • There isn't a backup lookup policy, if a procedure is not found in the PROPATH or a file in the workDir, an error is raised.

Both properties are set in openedge.properties

[AppServer.Agent]
    workDir=${CATALINA_BASE}/work
    ...
    PROPATH=${CATALINA_BASE}/openedge,${DLC}/tty,${DLC}/tty/netlib/OpenEdge.Net.pl

Constantin, I think the changes in 10313b reflect the OE behavior, but there are older changes that are more lenient, meaning we look first in the working dir, if not found we look in PROPATH, this is not what OE does, but I don't think this is a serious issue.

#80 Updated by Artur Școlnic 5 months ago

  • % Done changed from 90 to 100

#81 Updated by Artur Școlnic 5 months ago

Unless there are no more concerns, I will start testing.

#82 Updated by Artur Școlnic 4 months ago

  • Status changed from Review to Internal Test

I tested the pasoe project on linux and windows, everything passed.

#83 Updated by Artur Școlnic 4 months ago

Constantin, are we ok to merge this one?

#84 Updated by Constantin Asofiei 4 months ago

  • Status changed from Internal Test to Merge Pending

Please merge now.

#85 Updated by Artur Școlnic 4 months ago

10313b is in trunk/16464.

#86 Updated by Alexandru Lungu 4 months ago

  • Status changed from Merge Pending to Test

Also available in: Atom PDF