File Upload does not work anymore

26 views
Skip to first unread message

Oliver Braun

unread,
May 27, 2011, 5:29:27 PM5/27/11
to gitit-discuss
Hi,

I am using gitit already for a long time on several machines, as
personal wiki, but also as wiki for all of my students and for all
projects.

Since I have upgraded to 0.8 file upload does not longer work. Tested
with different gitit-instances and with different browsers, I always
get:

Server error: examplefile.txt: canonicalizePath: does not exist (No
such file or directory)

I am using Gentoo with gitit installed from the gentoo-haskell
overlay.

Any ideas?

I really like gitit and want to go on using it, but without file
upload it is not feasable at least for the student projects.

Kind regards,
Oliver

John MacFarlane

unread,
May 31, 2011, 12:53:02 AM5/31/11
to gitit-...@googlegroups.com
+++ Oliver Braun [May 27 11 14:29 ]:

Interesting. It works for me. What OS are you using?

John

Oliver Braun

unread,
May 31, 2011, 10:13:23 AM5/31/11
to gitit-discuss
Hi,

I am using Gentoo Linux on all machines, e.g.,

$ uname -a
Linux mammut 2.6.38-gentoo-r6 #1 SMP Fri May 27 21:21:46 CEST 2011
x86_64 Intel(R) Core(TM)2 Quad CPU @ 2.40GHz GenuineIntel GNU/Linux

$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.0.3

$ ghc-pkg list gitit
/usr/lib64/ghc-7.0.3/package.conf.d
gitit-0.8

I have tried both gitit from the gentoo-haskell overlay and from
hackage using cabal install gitit.

Still the same problem:

Server error: /home/obraun/wiki/wikidata/pads.jpg: canonicalizePath:
does not exist (No such file or directory)

Any ideas?

Oliver

John MacFarlane

unread,
May 31, 2011, 12:32:16 PM5/31/11
to gitit-...@googlegroups.com
+++ Oliver Braun [May 31 11 07:13 ]:

> Hi,
>
> I am using Gentoo Linux on all machines, e.g.,
>
> $ uname -a
> Linux mammut 2.6.38-gentoo-r6 #1 SMP Fri May 27 21:21:46 CEST 2011
> x86_64 Intel(R) Core(TM)2 Quad CPU @ 2.40GHz GenuineIntel GNU/Linux
>
> $ ghc --version
> The Glorious Glasgow Haskell Compilation System, version 7.0.3
>
> $ ghc-pkg list gitit
> /usr/lib64/ghc-7.0.3/package.conf.d
> gitit-0.8
>
> I have tried both gitit from the gentoo-haskell overlay and from
> hackage using cabal install gitit.
>
> Still the same problem:
>
> Server error: /home/obraun/wiki/wikidata/pads.jpg: canonicalizePath:
> does not exist (No such file or directory)

Is there a file there (/home/obraun/wiki/wikidata/pads.jpg)?

When you go to "Upload a file", what do you put for "Name on wiki"?

John

Oliver Braun

unread,
Jun 1, 2011, 2:10:38 PM6/1/11
to gitit-discuss
no, there is no file. BTW, I am using git.

The name in the field "Name on wiki" was pads.jpg.

Oliver

John MacFarlane

unread,
Jun 1, 2011, 2:22:56 PM6/1/11
to gitit-...@googlegroups.com
What about /home/obraun/wiki/wikidata? Can you confirm that this
directory exists? canonicalizePath "/eek/foo" will raise this error if
the "/eek" directory does not exist.

By the way: the call to canonicalizePath is made by the function
isInsideDir, which is called by uploadFile in Nework/Gitit/Handlers.hs
to determine whether the file to be uploaded would be in the staticDir
or templatesDir. (See lines 201-4).

John

+++ Oliver Braun [Jun 01 11 11:10 ]:

Oliver Braun

unread,
Jun 2, 2011, 3:07:15 PM6/2/11
to gitit-discuss
Yes, /home/obraun/wiki/wikidata exists. It is the repository_path from
the config file.

I have removed the lines you mentioned and it works. I have also found
out that there was a small change in System.Directory between 1.0.1.1
and 1.0.1.2

In 1.0.1.1 the function is:

canonicalizePath :: FilePath -> IO FilePath
canonicalizePath fpath =
// lines removed
do c_realpath pInPath pOutPath
// lines removed

and starting with 1.0.1.2 it is:

do throwErrnoPathIfNull "canonicalizePath" fpath $ c_realpath
pInPath pOutPath

If I understand correctly your checks are performed BEFORE the file
upload is really done. It fails since the file is not yet there, as
you can see in this ghci-session:

GHCi, version 7.0.3: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package ffi-1.0 ... linking ... done.
Prelude> :m System.Directory
Prelude System.Directory> canonicalizePath "gitit.cabal"
Loading package old-locale-1.0.0.2 ... linking ... done.
Loading package old-time-1.0.0.6 ... linking ... done.
Loading package unix-2.4.2.0 ... linking ... done.
Loading package filepath-1.2.0.0 ... linking ... done.
Loading package directory-1.1.0.0 ... linking ... done.
"/tmp/gitit-0.8/gitit.cabal"
Prelude System.Directory> canonicalizePath "gitit.jpg"
*** Exception: gitit.jpg: canonicalizePath: does not exist (No such
file or directory)

Unfortunately I have no older ghc-version lying arround, so I cannot
test it with directory-1.0.1.1.

Oliver

John MacFarlane

unread,
Jun 6, 2011, 3:31:10 PM6/6/11
to gitit-...@googlegroups.com
Thanks for tracking this down! I've used a different approach and
fixed the problem in bb2f3911bd72ef4f84e88fded3193190b27a3043.

John

+++ Oliver Braun [Jun 02 11 12:07 ]:

Oliver Braun

unread,
Jun 7, 2011, 8:40:07 AM6/7/11
to gitit-discuss
Great! Thanks!

Oliver
Reply all
Reply to author
Forward
0 new messages