KSP-KOS / KOS

Fully programmable autopilot mod for KSP. Originally By Nivekk
Other
687 stars 229 forks source link

cannot run scripts with mixed-case filenames #1496

Open jberkman opened 8 years ago

jberkman commented 8 years ago

my files are named bootDunaDirect.ks, ddLaunch.ks, ddDock.ks, etc.

with 0.19, i'm unable to run them - i get File 'bootdunadirect' not found from the console.

things i've tried that don't work:

run bootdunadirect. (worked in 0.18)
run bootdunadirect.ks.
run bootDunaDirect.ks.
run "bootDunaDirect.ks".

the only thing that does is to rename the file bootdunadirect.ks.

this happens both from the console and if a script runs another script.

Thanks!

TDW89 commented 8 years ago

@jberkman can you confirm what os you are using (windows, linux, apple). I have just tested this on windows and it still runs mixed case file names for me. If you are experiencing this on windows then there may be an issue.

What you are describing has always been the case with linux and apple, as their file systems are case sensitive. Windows is case insensitive so as far as its concerned test.ks and TEST.KS are the same file. Apple and Linux both use case sensitive file systems so as far as they are concerned test.ks and TEST.ks are different files and can exist alongside each other in the same folder.

kOS stores all it's variables in lowercase meaning that however you typed it the file name will always be stored in lowercase. Dunbaratu gave a good explanation of why it was implemented that way in #762 which is worth a read if you want a more detailed answer.

jberkman commented 8 years ago

yes, this is on windows (10). it worked fine on 0.18 on both windows and os x.

(fwiw, by default HFS+ on OS X is case-preserving, but not case-sensitive; you cannot have two files whose names differ only by case)

gisikw commented 8 years ago

I'm also unable to reproduce on Windows 10.

Is there any chance you might have forgotten to switch to the archive volume?

hvacengi commented 8 years ago

Can you please upload your output_log.txt for us to review since we seem to be having a hard time reproducing the error? I think github now supports attaching text files to issues, otherwise we'd ask that you use a host like dropbox, pastebin, or your favorite similar service.

adolfgatonegro commented 8 years ago

Hi, I'm having the same issue, not only with run but also with edit, rename and, to a point, with delete. I'm running 1.0.5 with kOS 0.19 on Windows 10 Pro.

For a basic sounding rocket with a CPU tagged SRCore the boot script will look for SRCore.launch.ks in the archive volume, copy it to the local volume, rename it to launch.ks and execute it. This worked just fine in the last version, but now I get File does not exist: launch.ks error when trying to rename the file. Trying to run a mixed-case file is impossible, trying to edit it simply creates a new file with the name in lower case, and delete only works if I wrap the file name in double quotes.

Switching the filename to lowercase fixes the problem, but having to go back to each vehicle to rename the core, and rename each mixed-case file I have is... less than ideal.

So, yeah. First time I've reported a bug in anything, so please let me know if any information is missing and I'll gladly provide it.

Thanks!

Dunbaratu commented 8 years ago

Does Windows 10 have the ability to use case-sensitive filesystems or something? Is that a feature it can turn on somewhere and that's why some people get this happening and some don't?

Alternatively, are those of you experiencing this bug using files stored remotely on some other file server, and is the file server itself storing files in a case-sensitive way?

hvacengi commented 8 years ago

@AdolfGatonegro, we will require your logs to be able to analyze the issue as we cannot reproduce. Please provide as many details about your system as possible, exact OS information (like a build number), the type of file system your hard drive uses, whether or not you use symbolic links, or drop box. We need to know everything possible, because we're shooting in the dark.

adolfgatonegro commented 8 years ago

@Dunbaratu, as far as I know NTFS is case-insensitive by default, although there's a way to force case-sensitivity in Windows Server (which I don't own). All the files are stored locally on my NTFS-formatted hard drive, and Windows itself is case-insensitive.

@hvacengi, sure, which logs should I upload? I've never had to do any troubleshooting with KSP so I'm not sure where the logs are and which ones do you need. (Edit: do you mean output_log.txt in KSP_Data?)

As far as my system goes, I'm running Windows 10 Professional v1511 (build 10586.122), with KSP 1.0.5 running (in DX11 mode) from a local NTFS-formatted hard drive. No sym-links, no network volumes or anything like that, all the scripts are stored in the same local volume.

hvacengi commented 8 years ago

output_log.txt from your KSP_Data folder (within the KSP directory). Make sure that you have tried to do each of the activities mentioned above in the KSP session before you upload it. We may end up giving you a package of files to do further debugging base on what we see in the log file.

adolfgatonegro commented 8 years ago

OK, this got a bit longer than I expected, but I ended up doing some more testing, hoping to give you as much information as possible. Here's my log: output_log.txt. Apologies for the massive file, but I run a heavily modded game. Here's a rundown of what I did:

  1. Loaded a previously built vessel, "kOS Test Ship", in Career Mode. This vehicle uses a Sounding Rocket Telemetry Unit with the tag TestCPU set to run boot.ks. In my Ships/Script folder is a file called TestCPU.launch.ks which contains a simple launch routine. boot.ks is stored in the same folder. Using the previous release of kOS, the vehicle would load, the boot script would copy TestCPU.launch.ks (via a variable called launchScript) to Volume 1, rename it to launch.ks and execute it without issue. No modifications made to the scripts or the vehicle.
  2. The vehicle is sent to the Launch Pad. Upon loading, the kOS terminal opens (DoEvent:("Open Terminal") in boot.ks). The following error message appears in the terminal:
File does not exist: launch.ks
__________________________________
        VERBOSE DESCRIPTION
File does not exist: launch.ks
At boot.ks on testcpu, line 45
rename launchScript to "launch.ks".
Called from sys:boot, line 1
(Can't show source line)

Printing the variable launchScript displays the correct filename: TestCPU.launch.ks.

  1. list command shows only boot.ks in Volume 1. Using the command line to copy "TestCPU.launch.ks" from 0. correctly copies the file to 1, including mixed-case name, however trying to rename the file from the command line using rename "TestCPU.launch.ks" to "launch.ks". produces the same error as above (File does not exist: launch.ks) and deletes TestCPU.launch.ks from volume 1, with list showing only the boot script.
  2. Editing the file. edit "TestCPU.launch.ks". shows the correct file in the in-game editor. The same command with the filename in lowercase (edit "testcpu.launch.ks") produces the following error: "File already exists: testcpu.launch.ks". The same error appears when removing double quotes, regardless of name casing.
  3. Running the file. Tried the run command and typing the file name in mixed-case, lowercase, with and without .ks extension, wrapped in double quotes and without them. All of those commands produced the error: File 'testcpu.launch.ks' not found.
  4. Deleting the file from volume 1. delete "TestCPU.launch.ks". works fine, however delete "testcpu.launch.ks". produces a "File not found" error.
  5. Back in the VAB, the ship was reloaded and the CPU tag was changed to "testcpu" in all lowercase. The script file was renamed "testcpu.launch.ks" outside the game. No other changes were made to the vehicle, and no changes were made to the scripts themselves. The results were the same.

After some testing I found that, besides the mixed-case issue, there seems to be an issue with the rename command, regardless of filename length or casing. As an example, the following sequence running on volume 1:

edit hello.
rename hello to helloagain.

results in a "File does not exist: helloagain.ks" error and the disappearance of the previously created hello.ks from volume 1 when the rename command is executed. However, renaming volumes works as expected.

Finally, modifying my boot file to avoid the rename command results in the correct execution of the rest of my code, just as it worked in the previous version of kOS.

hvacengi commented 8 years ago

Just to let you know, rename was fixed in the most recent release (pushed out earlier this evening, v0.19.1), so that error itself is fixed. I'll read through your log and your account tonight or tomorrow and see if we can come up with anything.

adolfgatonegro commented 8 years ago

Didn't know about 0.19.1, thanks for the heads up. Let me know if you need me to test anything else.

hvacengi commented 8 years ago

Will do. Maybe we'll get lucky and something will be visible in the log that won't require more testing.