<< Back to previous view

[CLJS-159] Suggest removing UNIX shell executable permissions from bin/cljsc.bat Created: 06/Mar/12  Updated: 27/Jul/13  Resolved: 14/Mar/12

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Yesudeep Mangalapilly Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: command, executable, linux, permissions, script, shell, unix, windows

Any UNIX platform.


Bash completion shows `bin/cljsc.bat` as an executable on UNIX systems
making it very easy to accidentally execute it. However, since
Windows command scripts do not work with UNIX shells, it is not
advisable to allow executable permissions to Windows batch scripts
as accidentally executing them may cause undefined behavior on such

I strongly suggest stripping UNIX shell executable permissions from

Thank you.


Comment by Yesudeep Mangalapilly [ 07/Mar/12 12:39 AM ]

The issue also affects:


Comment by Craig Andera [ 12/Mar/12 1:34 PM ]

I've verified (on both Ubuntu Linux and Windows 7) that stripping the x bit from those files has the desired effect.

The patch is almost too trivial to bother with listing here, but here it is regardless:

diff --git a/bin/cljsc.bat b/bin/cljsc.bat
old mode 100755
new mode 100644
diff --git a/script/repl.bat b/script/repl.bat
old mode 100755
new mode 100644
diff --git a/script/repljs.bat b/script/repljs.bat
old mode 100755
new mode 100644
Comment by David Nolen [ 14/Mar/12 7:22 PM ]

Fixed, https://github.com/clojure/clojurescript/commit/aa51a01141131736871e791918df63f185155421

[CLJ-959] after call to clojure.java.shell/sh, jvm won't exit Created: 26/Mar/12  Updated: 05/Feb/14  Resolved: 05/Feb/14

Status: Closed
Project: Clojure
Component/s: None
Affects Version/s: Release 1.3, Release 1.4
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Jeff Chiu Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: shell

Reproduced on Ubuntu using Sun Java 1.6, OpenJDK 1.6, and Sun Java 1.7


Create the following four-line file, shell_example.clj:

;; simple example of call to sh that causes jvm to hang after print
(require '[clojure.java.shell :as shell])
(shell/sh "ls")
(println "jvm should exit after this, but it doesn't")

java -jar clojure-1.3.0.jar shell_example.clj

After the message is printed, the jvm doesn't quit. It just sits there. I have to hit Ctrl-C to force the jvm to quit.

This happens on 1.3 and the most recent code in github as of 3/26/2012. I imagine the jvm is waiting for a thread that hasn't terminated, but the code in the sh function doesn't look like it's doing anything obviously wrong. I'm too much of a newcomer to Clojure to dig any deeper.

My workaround right now is to do (System/exit 0) to force the jvm to quit.

Thank you for your work on Clojure, it's simply an amazing language.

Comment by Andy Fingerhut [ 27/Mar/12 12:19 AM ]

Jeff, this occurs in any Clojure program where certain threading mechanisms are invoked. In your case, clojure.java.shell/sh uses future, which causes threads to be created that then sit around for about 60 seconds after everything else quits, and the main Java process does not exit until that happens. Another way to get the program to exit quickly is to call (shutdown-agents), but that isn't any more convenient than (System/exit 0), nor is there any obvious way you can tell as a newcomer that you should be doing this.

The ticket CLJ-124 is marked with status "Approved" at this time, which leads me to believe that perhaps soon there will be a change made to Clojure such that this situation will change.

Comment by Andy Fingerhut [ 08/Jun/12 12:47 PM ]

This behavior is now documented on clojuredocs.org for future, and both pmap and clojure.java.shell/sh refer to future for details.

Comment by Alex Miller [ 05/Feb/14 12:56 PM ]

This ticket is effectively a duplicate of CLJ-120 regarding shutdown properties after use of future/agent (sh uses future). Can't see any purpose in leaving this open.

Comment by Andy Fingerhut [ 05/Feb/14 1:01 PM ]

That would be CLJ-124, not CLJ-120 as stated in the previous comment, in case anyone wants to follow the links later. A bit confusing since CLJ-124 has a summary description with 120 in it.

Generated at Wed Jan 17 14:44:23 CST 2018 using JIRA 4.4#649-r158309.