se-edu/addressbook-level1

runtests.bat: File access errors when case sensitive attribute is enabled on directories

Creastery opened this issue · 0 comments

Subject of the Issue

runtests.bat reports file access errors when the case sensitive attribute of \src or \test directories is enabled.

There are two related sub-problems discovered:

  1. Typographical error in runtests.bat:10 resulting in javac reporting a "file not found" error.
    javac ..\src\seedu\addressbook\Addressbook.java -d ..\bin should have been:
    javac ..\src\seedu\addressbook\AddressBook.java -d ..\bin
  2. fc file compare utility tool shipped with Windows (used in runtests.bat:35 - FC actual.txt expected.txt) is unable to access files residing in directories with case sensitive attribute enabled

This unintentional bug was likely introduced with the release of Windows 10 Redstone 4 Insider Build 17093, as the case sensitive attribute for directories was first introduced in this particular Windows 10 Insider Build (eventually released in Windows 10 Redstone 4 officially as well).

Tested on Environment(s)

  • Fully updated Windows 10 Version 1803 (April 2018 Update) a.k.a. Windows 10 Redstone 4
  • Fully updated Windows 10 Version 1809 (October 2018 Update) a.k.a. Windows 10 Redstone 5
  • WSL installed and enabled (required to reproduce this bug)
  • Oracle JDK 9.0.4

Sub-problem 1: javac reporting a "file not found" error

Steps to Reproduce

  1. Ensure that WSL optional feature is installed and enabled by running the following command in PowerShell as Administrator:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
  1. Restart the computer when prompted
  2. Ensure that case sensitive attribute is enabled in \src directory:
C:\[REDACTED]\addressbook-level1>fsutil file setCaseSensitiveInfo .\src enable
Case sensitive attribute on directory C:\[REDACTED]\addressbook-level1\src is enabled.
  1. Execute runtests.bat

Expected Behaviour

No errors when running runtests.bat.

In \test directory:

C:\[REDACTED]\addressbook-level1\test>runtests.bat
        1 file(s) copied.

C:\[REDACTED]\addressbook-level1\test>echo %ERRORLEVEL%
0

Outside \test directory:

C:\[REDACTED]\addressbook-level1>test\runtests.bat
        1 file(s) copied.

C:\[REDACTED]\addressbook-level1>echo %ERRORLEVEL%
0

Actual Behaviour

When running runtests.bat, javac reports a "file not found" error.

In \test directory:

C:\[REDACTED]\addressbook-level1\test>runtests.bat
javac: file not found: ..\src\seedu\addressbook\Addressbook.java
Usage: javac <options> <source files>
use --help for a list of possible options
********** BUILD FAILURE **********

C:\[REDACTED]\addressbook-level1\test>echo %ERRORLEVEL%
1

Outside \test directory:

C:\[REDACTED]\addressbook-level1>test\runtests.bat
javac: file not found: ..\src\seedu\addressbook\Addressbook.java
Usage: javac <options> <source files>
use --help for a list of possible options
********** BUILD FAILURE **********

C:\[REDACTED]\addressbook-level1>echo %ERRORLEVEL%
1

Suggested Fix:

Simply replace javac ..\src\seedu\addressbook\Addressbook.java -d ..\bin found at runtests.bat:10 with javac ..\src\seedu\addressbook\AddressBook.java -d ..\bin.

Sub-problem 2: fc reporting a "no such file or folder" error

Steps to Reproduce

  1. Ensure that WSL optional feature is installed and enabled by running the following command in PowerShell as Administrator:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
  1. Restart the computer when prompted
  2. Ensure that case sensitive attribute is enabled in \test directory:
C:\[REDACTED]\addressbook-level1>fsutil file setCaseSensitiveInfo .\test enable
Case sensitive attribute on directory C:\[REDACTED]\addressbook-level1\test is enabled.
  1. Fix the typographical error in runtests.bat:10 by replacing the affected line with:
    javac ..\src\seedu\addressbook\AddressBook.java -d ..\bin
  2. Execute runtests.bat

Expected Behaviour

No errors when running runtests.bat.

In \test directory:

C:\[REDACTED]\addressbook-level1\test>runtests.bat
        1 file(s) copied.

C:\[REDACTED]\addressbook-level1\test>echo %ERRORLEVEL%
0

Outside \test directory:

C:\[REDACTED]\addressbook-level1>test\runtests.bat
        1 file(s) copied.

C:\[REDACTED]\addressbook-level1>echo %ERRORLEVEL%
0

Actual Behaviour

When running runtests.bat, fc reports a "no such file or folder" error.

In \test directory:

C:\[REDACTED]\addressbook-level1\test>runtests.bat
        1 file(s) copied.
FC: cannot open ACTUAL.TXT - No such file or folder

C:\[REDACTED]\addressbook-level1>echo %ERRORLEVEL%
2

Outside \test directory:

C:\[REDACTED]\addressbook-level1>test\runtests.bat
        1 file(s) copied.
FC: cannot open ACTUAL.TXT - No such file or folder

C:\[REDACTED]\addressbook-level1>echo %ERRORLEVEL%
2

Suggested Fix:

Due to the way how the fc file compare Windows utility tool parses and transforms filepaths internally, one possible fix for this problem is to disable the case sensitivity attribute of \test directory, unless Microsoft fixes the way how the fc tool parses and interprets filepaths.