emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* bug#16751: 24.3.50; Export during Org export to HTML
       [not found]             ` <834n3n17vg.fsf@gnu.org>
@ 2014-02-25 17:12               ` Bastien
  2014-02-25 17:49                 ` Eli Zaretskii
                                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Bastien @ 2014-02-25 17:12 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Sebastien Vauban, 16751

Eli Zaretskii <eliz@gnu.org> writes:

> Ugh.  Bastien, could you (or someone else of Org developers) please
> look into this?  Why does the URI above causes the recent version of
> Org to pass an invalid file name such as
>
>    ///opt/tomcat/4/apache-tomcat-4.1.40/... to expand-file-name

I will look into this, but I can't promise anything before next week.

Thanks for the heads up,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#16751: 24.3.50; Export during Org export to HTML
  2014-02-25 17:12               ` bug#16751: 24.3.50; Export during Org export to HTML Bastien
@ 2014-02-25 17:49                 ` Eli Zaretskii
  2014-02-25 18:04                 ` Nicolas Goaziou
       [not found]                 ` <83ob1vytf5.fsf@gnu.org>
  2 siblings, 0 replies; 12+ messages in thread
From: Eli Zaretskii @ 2014-02-25 17:49 UTC (permalink / raw)
  To: Bastien; +Cc: sva-news, 16751

> From: Bastien <bzg@altern.org>
> Cc: Sebastien Vauban <sva-news@mygooglest.com>,  16751@debbugs.gnu.org
> Date: Tue, 25 Feb 2014 18:12:05 +0100
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > Ugh.  Bastien, could you (or someone else of Org developers) please
> > look into this?  Why does the URI above causes the recent version of
> > Org to pass an invalid file name such as
> >
> >    ///opt/tomcat/4/apache-tomcat-4.1.40/... to expand-file-name
> 
> I will look into this, but I can't promise anything before next week.

Thanks.  There's no rush.  I will fix expand-file-name so it doesn't
crash with such bogus file names.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#16751: 24.3.50; Export during Org export to HTML
  2014-02-25 17:12               ` bug#16751: 24.3.50; Export during Org export to HTML Bastien
  2014-02-25 17:49                 ` Eli Zaretskii
@ 2014-02-25 18:04                 ` Nicolas Goaziou
  2014-02-25 18:32                   ` Eli Zaretskii
       [not found]                   ` <83lhwzyrdw.fsf@gnu.org>
       [not found]                 ` <83ob1vytf5.fsf@gnu.org>
  2 siblings, 2 replies; 12+ messages in thread
From: Nicolas Goaziou @ 2014-02-25 18:04 UTC (permalink / raw)
  To: Bastien; +Cc: Sebastien Vauban, 16751, Eli Zaretskii

Hello,

Bastien <bzg@altern.org> writes:

>> Ugh.  Bastien, could you (or someone else of Org developers) please
>> look into this?  Why does the URI above causes the recent version of
>> Org to pass an invalid file name such as
>>
>>    ///opt/tomcat/4/apache-tomcat-4.1.40/... to expand-file-name
>
> I will look into this, but I can't promise anything before next week.
>
> Thanks for the heads up,

A quick analysis.

    file:path

is a valid file link type in Org. Therefore,

    file:///opt/tomcat/4/apache-tomcat-4.1.40/webapps/../user_projects/GHIJSP2/deploy/WEB-INF/sharedfiles/resources/FR/domVal.xml

is parsed as a file link with path:

    ///opt/tomcat/4/apache-tomcat-4.1.40/webapps/../user_projects/GHIJSP2/deploy/WEB-INF/sharedfiles/resources/FR/domVal.xml

This path passes `file-name-absolute-p' predicate, so "ox-html.el"
concatenates "file://" to

  (expand-file-name path)

Since path is absolute, per `file-name-absolute-p', `expand-file-name'
is probably needed for its "and canonicalize it" part.

Note that other export back-ends, like, "ox-md.el", also use this
construct.

FWIW, I don't see any wrong behaviour here (except that "file://" should
probably not be prepended to path in this case).


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#16751: 24.3.50; Export during Org export to HTML
  2014-02-25 18:04                 ` Nicolas Goaziou
@ 2014-02-25 18:32                   ` Eli Zaretskii
  2014-02-25 19:11                     ` Achim Gratz
       [not found]                   ` <83lhwzyrdw.fsf@gnu.org>
  1 sibling, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2014-02-25 18:32 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: sva-news, bzg, 16751

> From: Nicolas Goaziou <n.goaziou@gmail.com>
> Cc: Eli Zaretskii <eliz@gnu.org>,  Sebastien Vauban <sva-news@mygooglest.com>,  16751@debbugs.gnu.org
> Date: Tue, 25 Feb 2014 19:04:10 +0100
> 
> >> Ugh.  Bastien, could you (or someone else of Org developers) please
> >> look into this?  Why does the URI above causes the recent version of
> >> Org to pass an invalid file name such as
> >>
> >>    ///opt/tomcat/4/apache-tomcat-4.1.40/... to expand-file-name
> >
> > I will look into this, but I can't promise anything before next week.
> >
> > Thanks for the heads up,
> 
> A quick analysis.
> 
>     file:path
> 
> is a valid file link type in Org. Therefore,
> 
>     file:///opt/tomcat/4/apache-tomcat-4.1.40/webapps/../user_projects/GHIJSP2/deploy/WEB-INF/sharedfiles/resources/FR/domVal.xml
> 
> is parsed as a file link with path:
> 
>     ///opt/tomcat/4/apache-tomcat-4.1.40/webapps/../user_projects/GHIJSP2/deploy/WEB-INF/sharedfiles/resources/FR/domVal.xml

But that's exactly the problem: producing a file name from a file://
URL requires to remove the "file://" prefix.  It is invalid to leave
the 2 extra slashes and remove only "file:".  Why does Org do that?

> FWIW, I don't see any wrong behaviour here (except that "file://" should
> probably not be prepended to path in this case).

Now I'm confused: why are you talking about prepending "file://", when
the problem, as I understand it, happens because "file://" was not
_removed_ from it together with the 2 slashes?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#16751: 24.3.50; Export during Org export to HTML
       [not found]                   ` <83lhwzyrdw.fsf@gnu.org>
@ 2014-02-25 18:41                     ` Glenn Morris
       [not found]                     ` <9e1tyrjar9.fsf@fencepost.gnu.org>
  1 sibling, 0 replies; 12+ messages in thread
From: Glenn Morris @ 2014-02-25 18:41 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: sva-news, bzg, Nicolas Goaziou, 16751

Eli Zaretskii wrote:

>>     file:path
>> 
>> is a valid file link type in Org. Therefore,
[...]
> But that's exactly the problem: producing a file name from a file://
> URL requires to remove the "file://" prefix.  It is invalid to leave
> the 2 extra slashes and remove only "file:".  Why does Org do that?

Presumably because Org decided to use "file:" rather than standard
"file://" URI, hence leading to exactly this confusion.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: bug#16751: 24.3.50; Export during Org export to HTML
  2014-02-25 18:32                   ` Eli Zaretskii
@ 2014-02-25 19:11                     ` Achim Gratz
  0 siblings, 0 replies; 12+ messages in thread
From: Achim Gratz @ 2014-02-25 19:11 UTC (permalink / raw)
  To: emacs-orgmode

Eli Zaretskii writes:
> But that's exactly the problem: producing a file name from a file://
> URL requires to remove the "file://" prefix.  It is invalid to leave
> the 2 extra slashes and remove only "file:".  Why does Org do that?

Because Org doesn't know squat about URI schemes and uses ad-hoc parsing
and manipulation rather than splicing it all out according to the spec.

Besides, why is three leading slashes even a problem?  IIRC, POSIX says
that any number of leading slashes (except when starting with exactly
two, which are system dependent and are usually interpreted as a UNC
path) should do exactly the same thing as a single slash.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Samples for the Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#BlofeldSamplesExtra

^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#16751: 24.3.50; Export during Org export to HTML
       [not found]                     ` <9e1tyrjar9.fsf@fencepost.gnu.org>
@ 2014-02-25 20:53                       ` Eli Zaretskii
  0 siblings, 0 replies; 12+ messages in thread
From: Eli Zaretskii @ 2014-02-25 20:53 UTC (permalink / raw)
  To: Glenn Morris; +Cc: sva-news, bzg, n.goaziou, 16751

> From: Glenn Morris <rgm@gnu.org>
> Cc: Nicolas Goaziou <n.goaziou@gmail.com>,  sva-news@mygooglest.com,  bzg@altern.org,  16751@debbugs.gnu.org
> Date: Tue, 25 Feb 2014 13:41:14 -0500
> 
> Eli Zaretskii wrote:
> 
> >>     file:path
> >> 
> >> is a valid file link type in Org. Therefore,
> [...]
> > But that's exactly the problem: producing a file name from a file://
> > URL requires to remove the "file://" prefix.  It is invalid to leave
> > the 2 extra slashes and remove only "file:".  Why does Org do that?
> 
> Presumably because Org decided to use "file:" rather than standard
> "file://" URI, hence leading to exactly this confusion.

That cannot be right, though, can it?  If Org wants to support
file:/foo, fine, but then it should try the standard file:///foo
before falling back on non-standard forms, I think.  Am I missing
something?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#16751: 24.3.50; Export during Org export to HTML
       [not found]                 ` <83ob1vytf5.fsf@gnu.org>
@ 2014-03-01 11:53                   ` Eli Zaretskii
  2014-03-21  8:17                     ` Bastien
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2014-03-01 11:53 UTC (permalink / raw)
  To: sva-news; +Cc: bzg, 16751

> Date: Tue, 25 Feb 2014 19:49:02 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: sva-news@mygooglest.com, 16751@debbugs.gnu.org
> 
> > From: Bastien <bzg@altern.org>
> > Cc: Sebastien Vauban <sva-news@mygooglest.com>,  16751@debbugs.gnu.org
> > Date: Tue, 25 Feb 2014 18:12:05 +0100
> > 
> > Eli Zaretskii <eliz@gnu.org> writes:
> > 
> > > Ugh.  Bastien, could you (or someone else of Org developers) please
> > > look into this?  Why does the URI above causes the recent version of
> > > Org to pass an invalid file name such as
> > >
> > >    ///opt/tomcat/4/apache-tomcat-4.1.40/... to expand-file-name
> > 
> > I will look into this, but I can't promise anything before next week.
> 
> Thanks.  There's no rush.  I will fix expand-file-name so it doesn't
> crash with such bogus file names.

I fixed expand-file-name (trunk revision 116624).  I'm keeping the bug
open until the Org part is either fixed or we decide it doesn't need
fixing.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#16751: 24.3.50; Export during Org export to HTML
  2014-03-01 11:53                   ` Eli Zaretskii
@ 2014-03-21  8:17                     ` Bastien
  2014-03-28 18:36                       ` Nicolas Goaziou
  0 siblings, 1 reply; 12+ messages in thread
From: Bastien @ 2014-03-21  8:17 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: sva-news, 16751

Hi Eli,

Eli Zaretskii <eliz@gnu.org> writes:

> I fixed expand-file-name (trunk revision 116624).

Thanks.

> I'm keeping the bug open until the Org part is either fixed or we
> decide it doesn't need fixing.

In my opinion, it needs a fix, but it's quite a rewrite, so don't
expect any change here before Org 9.0.

If someone wants to work on this, help is welcome.

Let's keep the bug open in the meantime.

-- 
 Bastien

^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#16751: 24.3.50; Export during Org export to HTML
  2014-03-21  8:17                     ` Bastien
@ 2014-03-28 18:36                       ` Nicolas Goaziou
  2014-04-10 21:03                         ` Nicolas Goaziou
  0 siblings, 1 reply; 12+ messages in thread
From: Nicolas Goaziou @ 2014-03-28 18:36 UTC (permalink / raw)
  To: Bastien; +Cc: sva-news, 16751, Eli Zaretskii

[-- Attachment #1: Type: text/plain, Size: 232 bytes --]

Hello,

Bastien <bzg@gnu.org> writes:

> If someone wants to work on this, help is welcome.

> Let's keep the bug open in the meantime.

Unless I'm mistaken, the following patch should fix the issue.


Regards,

-- 
Nicolas Goaziou

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Make-Org-links-compatible-with-URI-syntax.patch --]
[-- Type: text/x-diff, Size: 4138 bytes --]

From 4d62387fe035d9aa3d1dc96d12d40c53dca2afe5 Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <n.goaziou@gmail.com>
Date: Fri, 28 Mar 2014 19:24:38 +0100
Subject: [PATCH] Make Org links compatible with URI syntax

* lisp/org.el (org-make-link-regexps): Allow optional double slashes
  after type.  Small refactoring.

* testing/lisp/test-org-element.el (test-org-element/link-parser):
  Update test.

This patch allows to write both [[file:/file.org]] and [[file:///file.org]].
See bug#16751.
---
 lisp/org.el                      | 43 ++++++++++++++++++----------------------
 testing/lisp/test-org-element.el |  6 ++----
 2 files changed, 21 insertions(+), 28 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index bb83eb7..53f142e 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5658,34 +5658,29 @@ stacked delimiters is N.  Escaping delimiters is not possible."
   "Update the link regular expressions.
 This should be called after the variable `org-link-types' has changed."
   (setq org-link-types-re
-	(concat
-	 "\\`\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):")
+	(concat "\\`" (regexp-opt org-link-types t) ":\\(?://\\)")
 	org-link-re-with-space
-	(concat
-	 "<?\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):"
-	 "\\([^" org-non-link-chars " ]"
-	 "[^" org-non-link-chars "]*"
-	 "[^" org-non-link-chars " ]\\)>?")
+	(concat "<?" (regexp-opt org-link-types t) ":\\(?://\\)"
+		"\\([^" org-non-link-chars " ]"
+		"[^" org-non-link-chars "]*"
+		"[^" org-non-link-chars " ]\\)>?")
 	org-link-re-with-space2
-	(concat
-	 "<?\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):"
-	 "\\([^" org-non-link-chars " ]"
-	 "[^\t\n\r]*"
-	 "[^" org-non-link-chars " ]\\)>?")
+	(concat "<?" (regexp-opt org-link-types t) ":\\(?://\\)?"
+		"\\([^" org-non-link-chars " ]"
+		"[^\t\n\r]*"
+		"[^" org-non-link-chars " ]\\)>?")
 	org-link-re-with-space3
-	(concat
-	 "<?\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):"
-	 "\\([^" org-non-link-chars " ]"
-	 "[^\t\n\r]*\\)")
+	(concat "<?" (regexp-opt org-link-types t) ":\\(?://\\)?"
+		"\\([^" org-non-link-chars " ]"
+		"[^\t\n\r]*\\)")
 	org-angle-link-re
-	(concat
-	 "<\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):"
-	 "\\([^" org-non-link-chars " ]"
-	 "[^" org-non-link-chars "]*"
-	 "\\)>")
+	(concat "<" (regexp-opt org-link-types t) ":\\(?://\\)?"
+		"\\([^" org-non-link-chars " ]"
+		"[^" org-non-link-chars "]*"
+		"\\)>")
 	org-plain-link-re
 	(concat
-	 "\\<\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):"
+	 "\\<" (regexp-opt org-link-types t) ":\\(?://\\)?"
 	 (org-re "\\([^ \t\n()<>]+\\(?:([[:word:]0-9_]+)\\|\\([^[:punct:] \t\n]\\|/\\)\\)\\)"))
 	;;	 "\\([^]\t\n\r<>() ]+[^]\t\n\r<>,.;() ]\\)")
 	org-bracket-link-regexp
@@ -5693,7 +5688,7 @@ This should be called after the variable `org-link-types' has changed."
 	org-bracket-link-analytic-regexp
 	(concat
 	 "\\[\\["
-	 "\\(\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):\\)?"
+	 "\\(" (regexp-opt org-link-types t) ":\\(?://\\)?\\)?"
 	 "\\([^]]+\\)"
 	 "\\]"
 	 "\\(\\[" "\\([^]]+\\)" "\\]\\)?"
@@ -5701,7 +5696,7 @@ This should be called after the variable `org-link-types' has changed."
 	org-bracket-link-analytic-regexp++
 	(concat
 	 "\\[\\["
-	 "\\(\\(" (mapconcat 'regexp-quote (cons "coderef" org-link-types) "\\|") "\\):\\)?"
+	 "\\(" (regexp-opt (cons "coderef" org-link-types) t) ":\\(?://\\)?\\)?"
 	 "\\([^]]+\\)"
 	 "\\]"
 	 "\\(\\[" "\\([^]]+\\)" "\\]\\)?"
diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el
index def1659..72eea22 100644
--- a/testing/lisp/test-org-element.el
+++ b/testing/lisp/test-org-element.el
@@ -1362,12 +1362,10 @@ e^{i\\pi}+1=0
   ;; ... with expansion.
   (should
    (equal
-    "//orgmode.org/worg"
+    "orgmode.org/worg"
     (org-test-with-temp-text "[[Org:worg]]"
       (let ((org-link-abbrev-alist '(("Org" . "http://orgmode.org/"))))
-	(org-element-property
-	 :path
-	 (org-element-map (org-element-parse-buffer) 'link 'identity nil t))))))
+	(org-element-property :path (org-element-context))))))
   ;; ... with translation.
   (should
    (equal
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* bug#16751: 24.3.50; Export during Org export to HTML
  2014-03-28 18:36                       ` Nicolas Goaziou
@ 2014-04-10 21:03                         ` Nicolas Goaziou
  2014-04-11  8:48                           ` Bastien
  0 siblings, 1 reply; 12+ messages in thread
From: Nicolas Goaziou @ 2014-04-10 21:03 UTC (permalink / raw)
  To: Bastien; +Cc: sva-news, 16751, Eli Zaretskii

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> Unless I'm mistaken, the following patch should fix the issue.

Applied.

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#16751: 24.3.50; Export during Org export to HTML
  2014-04-10 21:03                         ` Nicolas Goaziou
@ 2014-04-11  8:48                           ` Bastien
  0 siblings, 0 replies; 12+ messages in thread
From: Bastien @ 2014-04-11  8:48 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: sva-news, 16751, Eli Zaretskii

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> Nicolas Goaziou <n.goaziou@gmail.com> writes:
>
>> Unless I'm mistaken, the following patch should fix the issue.
>
> Applied.

Thanks!

-- 
 Bastien

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2014-04-11 13:23 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <86fvnmoxyp.fsf@somewhere.org>
     [not found] ` <mailman.15076.1392372434.10748.bug-gnu-emacs@gnu.org>
     [not found]   ` <86txbwlkeh.fsf@somewhere.org>
     [not found]     ` <83ha7w75sc.fsf@gnu.org>
     [not found]       ` <86wqgk7npj.fsf@somewhere.org>
     [not found]         ` <mailman.15924.1393259115.10748.bug-gnu-emacs@gnu.org>
     [not found]           ` <86mwhf4jpo.fsf@somewhere.org>
     [not found]             ` <834n3n17vg.fsf@gnu.org>
2014-02-25 17:12               ` bug#16751: 24.3.50; Export during Org export to HTML Bastien
2014-02-25 17:49                 ` Eli Zaretskii
2014-02-25 18:04                 ` Nicolas Goaziou
2014-02-25 18:32                   ` Eli Zaretskii
2014-02-25 19:11                     ` Achim Gratz
     [not found]                   ` <83lhwzyrdw.fsf@gnu.org>
2014-02-25 18:41                     ` Glenn Morris
     [not found]                     ` <9e1tyrjar9.fsf@fencepost.gnu.org>
2014-02-25 20:53                       ` Eli Zaretskii
     [not found]                 ` <83ob1vytf5.fsf@gnu.org>
2014-03-01 11:53                   ` Eli Zaretskii
2014-03-21  8:17                     ` Bastien
2014-03-28 18:36                       ` Nicolas Goaziou
2014-04-10 21:03                         ` Nicolas Goaziou
2014-04-11  8:48                           ` Bastien

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).