OCaml Forge

Detail: [#830] '$rm path/file' doesn't work on windows

Bugs: Browse | Download .csv | Monitor

[#830] '$rm path/file' doesn't work on windows

Date:
2010-12-15 10:33
Priority:
3
State:
Open
Submitted by:
ygrek (ygrek)
Assigned to:
Sylvain Le Gall (gildor-admin)
Product:
OASIS
Due in version:
None
Resolution:
Accepted As Bug
Severity:
normal
Version:
0.2.0
Component:
Base
Operating System:
Windows XP
 
URL:
Summary:
'$rm path/file' doesn't work on windows

Detailed description
Here is the corresponding log - from http://build.ygrek.org.ua/hudson/job/extunix/label=qemu-i386-win2k,ocaml=default/78/console :

+ ocaml setup.ml -distclean
I: Running command 'C:\prog\ocaml-3.11.0-mingw\bin\ocamlc.opt.EXE -config > .\oasis-f7c740.txt'
I: Running command 'C:\prog\ocaml-3.11.0-mingw\bin\ocamlbuild.EXE -classic-display -no-log -no-links -install-lib-dir C:\prog\ocaml-3.11.0-mingw\lib\ocamlbuild -byte-plugin -clean -tag debug'
mkdir _build
+ mkdir _build
rm -Rf _build
+ rm -Rf _build
I: Remove 'C:\hudson\workspace\extunix\label\qemu-i386-win2k\ocaml\default\setup.log'
I: Running command 'del src/config.h'
Invalid switch - "config.h".
W: Command '$rm src/config.h' fail with error: Command 'del src/config.h' terminated with error code 1
I: Running command 'del src/config.ml'
Invalid switch - "config.ml".
W: Command '$rm src/config.ml' fail with error: Command 'del src/config.ml' terminated with error code 1

So either everybody should use utoh macro when using $rm (this won't happen) or $rm should implicitly convert paths or oasis should implement $rm with Sys.remove which perfectly accepts forward slashes on windows.

Followup

Message
Date: 2010-12-17 12:31
Sender: ygrek

Thanks. BTW the manual should be updated. And this looks even more ugly.. One idea was to have a special field for files generated during preconf/postconf actions - so that they will be removed at distclean - but that seems an overkill. Probably this issue is not very important at all cause not many projects should have custom distclean actions..
Date: 2010-12-17 11:00
Sender: Sylvain Le Gall

I think it is $(utoh "src/config.ml").
Date: 2010-12-17 09:05
Sender: ygrek

Hm, what is the correct way to use utoh ?
Currently I get :

W: Command '$rm $(utoh src/config.h)' fail with error: Unknown expression 'utoh src/config.h' in variable expansion of $(utoh src/config.h).
W: Command '$rm $(utoh src/config.ml)' fail with error: Unknown expression 'utoh src/config.ml' in variable expansion of $(utoh src/config.ml).
Date: 2010-12-16 08:21
Sender: ygrek

At least it will be better than current behavior :)
Date: 2010-12-15 11:13
Sender: Sylvain Le Gall

What about a warning when compiling the _oasis file ?

E.g.

W: In '$rm src/config.ml' the path argument 'src/config.ml' should be converted using 'utoh' to work on Windows

This is fairly easy to detect and to warn about.

Attached Files:

Changes:

Field Old Value Date By
Operating SystemNone2010-12-15 11:13gildor-admin
ComponentOASIS2010-12-15 11:13gildor-admin
SeverityNone2010-12-15 11:13gildor-admin
ResolutionNone2010-12-15 11:13gildor-admin
assigned_tonone2010-12-15 11:13gildor-admin