<!-- 
RSS generated by JIRA (4.4#649-r158309) at Tue May 21 07:54:47 CDT 2013

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary add field=key&field=summary to the URL of your request.
For example:
http://dev.clojure.org/jira/si/jira.issueviews:issue-xml/CLJ-1168/CLJ-1168.xml?field=key&field=summary
-->
<rss version="0.92" >
<channel>
    <title>Clojure JIRA</title>
    <link>http://dev.clojure.org/jira</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>4.4</version>
        <build-number>649</build-number>
        <build-date>25-07-2011</build-date>
    </build-info>

<item>
            <title>[CLJ-1168] Setting clojure.read.eval to unknown on JVM cmd line causes --eval option to fail</title>
                <link>http://dev.clojure.org/jira/browse/CLJ-1168</link>
                <project id="10010" key="CLJ">Clojure</project>
                        <description>&lt;p&gt;First discovered by Tim McCormack with Clojure 1.5.0-beta13 and -RC15:&lt;/p&gt;

&lt;p&gt;$ java -Dclojure.read.eval=unknown -jar ~/.m2/repository/org/clojure/clojure/1.5.0-RC16/clojure-1.5.0-RC16.jar -e &quot;(+ 1 2)&quot;&lt;br/&gt;
Exception in thread &quot;main&quot; java.lang.RuntimeException: Reading disallowed - &lt;b&gt;read-eval&lt;/b&gt; bound to :unknown&lt;/p&gt;

&lt;p&gt;This would prevent a Leiningen user from putting the following line in their project.clj file in order to look for read or read-string calls that don&apos;t explicitly bind &lt;b&gt;read-eval&lt;/b&gt; to true or false:&lt;/p&gt;

&lt;p&gt;    :jvm-opts &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;-Dclojure.read.eval=unknown&amp;quot;&amp;#93;&lt;/span&gt;&lt;/p&gt;</description>
                <environment></environment>
            <key id="16021">CLJ-1168</key>
            <summary>Setting clojure.read.eval to unknown on JVM cmd line causes --eval option to fail</summary>
                <type id="4" iconUrl="http://dev.clojure.org/jira/images/icons/improvement.gif">Enhancement</type>
                                <priority id="4" iconUrl="http://dev.clojure.org/jira/images/icons/priority_minor.gif">Minor</priority>
                    <status id="6" iconUrl="http://dev.clojure.org/jira/images/icons/status_closed.gif">Closed</status>
                    <resolution id="1">Completed</resolution>
                                <assignee username="-1">Unassigned</assignee>
                                <reporter username="jafingerhut">Andy Fingerhut</reporter>
                        <labels>
                    </labels>
                <created>Tue, 19 Feb 2013 19:23:08 -0600</created>
                <updated>Fri, 22 Feb 2013 14:12:22 -0600</updated>
                    <resolved>Fri, 22 Feb 2013 14:12:22 -0600</resolved>
                            <version>Release 1.5</version>
                                                        <due></due>
                    <votes>0</votes>
                        <watches>3</watches>
                        <comments>
                    <comment id="30623" author="jafingerhut" created="Tue, 19 Feb 2013 19:42:00 -0600"  >&lt;p&gt;Patch clj-1168-patch-v1.txt dated Feb 19 2013 has been tested manually with these results:&lt;/p&gt;

&lt;p&gt;% java -cp clojure.jar clojure.main&lt;/p&gt;

&lt;p&gt;(ran some simple tests to ensure repl still works, and obeys -Dclojure.read.eval=unknown setting)&lt;/p&gt;

&lt;p&gt;% java -Dclojure.read.eval=unknown -jar clojure.jar -e &apos;(println (+ 1 2))&apos;&lt;br/&gt;
3&lt;/p&gt;</comment>
                    <comment id="30634" author="steveminer@gmail.com" created="Wed, 20 Feb 2013 16:52:48 -0600"  >&lt;p&gt;The patch works for me, but I think it would be safer for the patch to treat &amp;#42;read-eval* :unknown as false for the purpose of -e.  It&apos;s unlikely that anyone wants to -e &apos;#=(boom)&apos;.  Also, there&apos;s no need for the let to capture the cur-read-eval.  I suggest something like this for the patch (updated):&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;(defn- read-never-unknown [read-fn &amp;amp; args]
      (binding [*read-eval* (&lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;? *read-eval*)]
         (apply read-fn args)))&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="30638" author="jafingerhut" created="Thu, 21 Feb 2013 06:10:48 -0600"  >&lt;p&gt;I have asked on the Leiningen email list whether treating &lt;b&gt;read-eval&lt;/b&gt; :unknown as false for the purpose of -e would break Leiningen functionality, and will report back here when I find out.&lt;/p&gt;</comment>
                    <comment id="30639" author="jafingerhut" created="Thu, 21 Feb 2013 15:02:30 -0600"  >&lt;p&gt;I don&apos;t have an answer from Leiningen folks yet, but I do have another thought related to Steve&apos;s comment:&lt;/p&gt;

&lt;p&gt;The current behavior is to treat &amp;#42;read-eval&amp;#42; as true for the purposes of reading lines in the REPL, if -Dclojure.read.eval=unknown was specified on the command line.  Why should expressions given after -e be any more restricted?  Whoever is invoking the JVM has complete control.&lt;/p&gt;

&lt;p&gt;If they really want &amp;#42;read-eval&amp;#42; to be false when reading the expressions after -e, just use -Dclojure.read.eval=false instead of =unknown.&lt;/p&gt;</comment>
                    <comment id="30640" author="steveminer@gmail.com" created="Thu, 21 Feb 2013 15:45:08 -0600"  >&lt;p&gt;You&apos;re right, the user has control.  I was just thinking that the user might not appreciate the details and it would be safer to default to the false behavior.  However, I failed to consider the REPL treatment &amp;#8211; that&apos;s a good point.&lt;/p&gt;

&lt;p&gt;In any case, the logic for the binding in the patch could be simplified.  I think this would work for the intended result:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;(defn- read-never-unknown [read-fn &amp;amp; args]
      (binding [*read-eval* (and *read-eval* &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;)]
         (apply read-fn args)))&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Sorry, if my comments have descended into bike-shedding.&lt;/p&gt;</comment>
                    <comment id="30643" author="stu" created="Fri, 22 Feb 2013 09:00:10 -0600"  >&lt;p&gt;I implemented &quot;with-read-known&quot; patch after input from Rich.  Helpers that establish bindings should take a closure or fn body, rather than carrying around explicit fns and arg lists as the original 19 Feb patch does.&lt;/p&gt;

&lt;p&gt;Marking screened as of the Feb 22 with-read-known patch.&lt;/p&gt;</comment>
                    <comment id="30644" author="timmc" created="Fri, 22 Feb 2013 09:55:13 -0600"  >&lt;p&gt;Steve: More importantly, any time you call (eval (read ...)), there&apos;s no reason for &amp;#42;read-eval&amp;#42; to be anything other than true.&lt;/p&gt;</comment>
                    <comment id="30645" author="timmc" created="Fri, 22 Feb 2013 10:12:43 -0600"  >&lt;p&gt;Newer patch works. My verification procedure:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;Patched master (should probably use an RC instead)&lt;/li&gt;
	&lt;li&gt;Compiled and installed (mvn install) with version = 1.5.0-clj1168 in pom.xml&lt;/li&gt;
	&lt;li&gt;Set up fresh Leiningen project including these options: &lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;:dependencies [[org.clojure/clojure &lt;span class=&quot;code-quote&quot;&gt;&quot;1.5.0-clj1168&quot;&lt;/span&gt;]]
:jvm-opts [&lt;span class=&quot;code-quote&quot;&gt;&quot;-Dclojure.read.eval=unknown&quot;&lt;/span&gt;]&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/li&gt;
	&lt;li&gt;Verify: `lein repl` succeeds
	&lt;ul&gt;
		&lt;li&gt;Verify: &lt;tt&gt;=&amp;gt; (read-string &quot;foo&quot;)&lt;/tt&gt; fails with &quot;Reading disallowed - &amp;#42;read-eval&amp;#42; bound to :unknown&quot;&lt;/li&gt;
		&lt;li&gt;Verify: &lt;tt&gt;=&amp;gt; #=(+ 1 2)&lt;/tt&gt; prints &lt;tt&gt;3&lt;/tt&gt; (read is fully available to REPL)&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
	&lt;li&gt;Write -main fn in project as &lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;(defn -main [&amp;amp; args]
  (println *read-eval*)
  (println (read-string (first args))))&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/li&gt;
	&lt;li&gt;Verify: `lein run foo` prints &lt;tt&gt;:unknown&lt;/tt&gt; and then fails with &quot;Reading disallowed&quot; error.&lt;/li&gt;
	&lt;li&gt;Bind &amp;#42;read-eval&amp;#42; to false in -main&lt;/li&gt;
	&lt;li&gt;Verify: `lein run foo` prints &lt;tt&gt;foo&lt;/tt&gt;.&lt;/li&gt;
&lt;/ul&gt;
</comment>
                </comments>
                    <attachments>
                    <attachment id="11864" name="clj-1168-patch-v1.txt" size="2348" author="jafingerhut" created="Tue, 19 Feb 2013 19:42:00 -0600" />
                    <attachment id="11873" name="CLJ-1168-with-read-known.patch" size="2298" author="stu" created="Fri, 22 Feb 2013 09:00:10 -0600" />
                </attachments>
            <subtasks>
        </subtasks>
                <customfields>
                                <customfield id="customfield_10002" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                <customfieldname>Approval</customfieldname>
                <customfieldvalues>
                        <customfieldvalue key="10007">Ok</customfieldvalue>

                </customfieldvalues>
            </customfield>
                                                                                    <customfield id="customfield_10010" key="com.pyxis.greenhopper.jira:gh-global-rank">
                <customfieldname>Global Rank</customfieldname>
                <customfieldvalues>
                    
                </customfieldvalues>
            </customfield>
                                            <customfield id="customfield_10000" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                <customfieldname>Patch</customfieldname>
                <customfieldvalues>
                        <customfieldvalue key="10001">Code</customfieldvalue>

                </customfieldvalues>
            </customfield>
                                                                                        </customfields>
    </item>
</channel>
</rss>