Error while opening URL via FileStream

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Error while opening URL via FileStream

Stefan Krecher
Hi,
i'm getting the following error when i try to read from an URL.
Same result under Windows/ Ubuntu/ Android - what am i doing wrong?
regards,
Stefan

st> PackageLoader fileInPackage: 'NetClients'
PackageLoader
st> (FileStream open: 'http://www.gnu.org/' mode: FileStream read) contents
Object: File error: Permission denied
SystemExceptions.FileError(Exception)>>signal (ExcHandling.st:254)
SystemExceptions.FileError class(Exception class)>>signal: (ExcHandling.st:161)
File class>>checkError: (File.st:83)
File class>>checkError (File.st:74)
File>>remove (File.st:526)
NetClients.WebEntity>>stream (/URIResolver.st:1342)
NetClients.URIResolver class>>openStreamOn:ifFail: (/URIResolver.st:75)
FileStream class(FileDescriptor class)>>open:mode:ifFail: (FileDescr.st:133)
FileStream class(FileDescriptor class)>>open:mode: (FileDescr.st:111)
UndefinedObject>>executeStatements (a String:1)
nil
st>

_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Error while opening URL via FileStream

Paolo Bonzini-2
Il 15/06/2012 10:49, Stefan Krecher ha scritto:
> st> PackageLoader fileInPackage: 'NetClients'
> PackageLoader
> st> (FileStream open: 'http://www.gnu.org/' mode: FileStream read) contents
> Object: File error: Permission denied
> SystemExceptions.FileError(Exception)>>signal (ExcHandling.st:254)
> SystemExceptions.FileError class(Exception class)>>signal: (ExcHandling.st:161)
> File class>>checkError: (File.st:83)
> File class>>checkError (File.st:74)
> File>>remove (File.st:526)

Can you run it under strace to see what file is being removed?

Paolo

_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Error while opening URL via FileStream

Stefan Krecher
Hi,
thanks for the strace-tip - i noticed that NetClients could not get
loaded - i fixed this, but now gst dies after opening the FileStream
(on Android), here are the last lines of the strace log, i have no
idea what's happening ...

connect(3, {sa_family=AF_INET, sin_port=htons(80),
sin_addr=inet_addr("208.118.235.148")}, 16) = -1 EINPROGRESS
(Operation now in progress)
sigprocmask(SIG_BLOCK, ~[QUIT ILL ABRT BUS SEGV], [QUIT TRAP USR2 PIPE
ALRM STKFLT CHLD]) = 0
sigprocmask(SIG_SETMASK, [QUIT TRAP USR2 PIPE ALRM STKFLT CHLD], NULL) = 0
poll([{fd=3, events=POLLOUT}], 1, 0)    = 0
sigaction(SIGIO, {0x3e338, ~[QUIT ILL ABRT BUS SEGV], 0}, {SIG_IGN}, 0) = 0
sigaction(SIGURG, {0x3e338, ~[QUIT ILL ABRT BUS SEGV], 0}, {SIG_IGN},
0xa999c) = 0
fcntl64(3, F_GETFL)                     = 0x802 (flags O_RDWR|O_NONBLOCK)
fcntl64(3, F_SETFL, O_RDWR|O_NONBLOCK|O_ASYNC) = 0
getpid()                                = 14499
fcntl64(3, F_SETOWN, 14499)             = 0
poll([{fd=3, events=POLLOUT}], 1, 0)    = 0
sigprocmask(SIG_BLOCK, ~[QUIT ILL ABRT BUS SEGV], [QUIT TRAP USR2 PIPE
ALRM STKFLT CHLD]) = 0
sigprocmask(SIG_SETMASK, [QUIT TRAP USR2 PIPE ALRM STKFLT CHLD], NULL) = 0
sigprocmask(SIG_BLOCK, ~[QUIT ILL ABRT BUS SEGV], [QUIT TRAP USR2 PIPE
ALRM STKFLT CHLD]) = 0
sigsuspend([])                          = -1 EINTR (Interrupted system call)
--- SIGIO (I/O possible) @ 0 (0) ---
)  = 29
sigaction(SIGIO, {0x3e338, ~[QUIT ILL ABRT BUS SEGV], 0}, {0x3e338,
~[QUIT ILL ABRT BUS KILL SEGV STOP], 0}, 0x4057d378) = 0

2012/6/15 Paolo Bonzini <[hidden email]>:

> Il 15/06/2012 10:49, Stefan Krecher ha scritto:
>> st> PackageLoader fileInPackage: 'NetClients'
>> PackageLoader
>> st> (FileStream open: 'http://www.gnu.org/' mode: FileStream read) contents
>> Object: File error: Permission denied
>> SystemExceptions.FileError(Exception)>>signal (ExcHandling.st:254)
>> SystemExceptions.FileError class(Exception class)>>signal: (ExcHandling.st:161)
>> File class>>checkError: (File.st:83)
>> File class>>checkError (File.st:74)
>> File>>remove (File.st:526)
>
> Can you run it under strace to see what file is being removed?
>
> Paolo



--
Dipl.-Wirtsch.-Inf. Stefan Krecher
Neulander Str. 17, 27374 Visselhövede
Tel +49(0)4262 958848
mobil +49(0)172 3608616
http://krecher.com

_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Error while opening URL via FileStream

Paolo Bonzini-2
Il 15/06/2012 12:14, Stefan Krecher ha scritto:
> Hi,
> thanks for the strace-tip - i noticed that NetClients could not get
> loaded - i fixed this, but now gst dies after opening the FileStream
> (on Android), here are the last lines of the strace log, i have no
> idea what's happening ...

Does it still fail _without_ strace?  This looks like a ptrace bug in
your Android kernel.

Paolo

_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Error while opening URL via FileStream

Stefan Krecher
without strace i get the following exception. I suspect that  the
Exception occurs while trying to write a temporary file.
Looking into URIResolver.st it seems that it tries to write to
UserProfileSettings default settingAt: 'tmpDir' - which is initialized
with the environment variable TEMP (and defaults to /tmp/ which is
nonexistent on Android).
But  exporting TEMP='./' does not seem to have an effect. Smalltalk
getenv: 'TEMP' returns the correct result but UserProfileSettings
default settingAt: 'tmpDir' returns an empty string ....


st> (FileStream open: 'http://www.gnu.org/' mode: FileStream read) contents
(FileStream open: 'http://www.gnu.org/' mode: FileStream read) contents
Object: FileStream error: could not open http://www.gnu.org/
SystemExceptions.FileError(Exception)>>signal (ExcHandling.st:254)
SystemExceptions.FileError class(Exception class)>>signal: (ExcHandling.st:161)
optimized [] in FileDescriptor class>>openTemporaryFile: (FileDescr.st:152)
FileStream(FileDescriptor)>>fileOp:with:ifFail: (FileDescr.st:878)
FileStream class(FileDescriptor class)>>openTemporaryFile: ("Scavenging... 47% r
eclaimed, done"
FileDescr.st:153)
NetClients.URIResolver>>tmpFile (NetClients.star#VFS.ZipFile/URIResolver.st:1309
)
NetClients.URIResolver>>doHTTPRequest:onSuccess: (NetClients.star#VFS.ZipFile/UR
IResolver.st:514)
NetClients.URIResolver>>requestHttpContents: (NetClients.star#VFS.ZipFile/URIRes
olver.st:566)
NetClients.URIResolver>>getHttpContents (NetClients.star#VFS.ZipFile/URIResolver
.st:503)
NetClients.URIResolver>>contentsNoSignal (NetClients.star#VFS.ZipFile/URIResolve
r.st:154)
[] in NetClients.URIResolver class>>openOn:ifFail: (NetClients.star#VFS.ZipFile/
URIResolver.st:58)
BlockClosure>>on:do:on:do: (BlkClosure.st:206)
NetClients.URIResolver class>>openOn:ifFail: (NetClients.star#VFS.ZipFile/URIRes
olver.st:63)
NetClients.URIResolver class>>openStreamOn:ifFail: (NetClients.star#VFS.ZipFile/
URIResolver.st:74)
FileStream class(FileDescriptor class)>>open:mode:ifFail: (FileDescr.st:133)
FileStream class(FileDescriptor class)>>open:mode: (FileDescr.st:111)
UndefinedObject>>executeStatements (a String:1)
292401 byte codes executed
which took 0.443 seconds (0.160s user+0.020s sys)
20179 primitives, percent 6.90
self returns 89, inst var returns 0, literal returns 0
34228 method cache lookups since last cleanup, percent 11.71
32705 method cache hits, 1523 misses, 95.55 percent hits
returned value is nil

2012/6/15 Paolo Bonzini <[hidden email]>:

> Il 15/06/2012 12:14, Stefan Krecher ha scritto:
>> Hi,
>> thanks for the strace-tip - i noticed that NetClients could not get
>> loaded - i fixed this, but now gst dies after opening the FileStream
>> (on Android), here are the last lines of the strace log, i have no
>> idea what's happening ...
>
> Does it still fail _without_ strace?  This looks like a ptrace bug in
> your Android kernel.
>
> Paolo



--
Dipl.-Wirtsch.-Inf. Stefan Krecher
Neulander Str. 17, 27374 Visselhövede
Tel +49(0)4262 958848
mobil +49(0)172 3608616
http://krecher.com

_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Error while opening URL via FileStream

Stefan Krecher
Ok, this could be a bug in URIResolver.st:
the method that is responsible for creating a tmp-file calls:
dir := UserProfileSettings default settingAt: 'tmpDir'.
and dir is an empty string.
I guess it should be dir := UserProfileSettings default settingAt: #tmpDir.
this returns the correct value.

2012/6/15 Stefan Krecher <[hidden email]>:

> without strace i get the following exception. I suspect that  the
> Exception occurs while trying to write a temporary file.
> Looking into URIResolver.st it seems that it tries to write to
> UserProfileSettings default settingAt: 'tmpDir' - which is initialized
> with the environment variable TEMP (and defaults to /tmp/ which is
> nonexistent on Android).
> But  exporting TEMP='./' does not seem to have an effect. Smalltalk
> getenv: 'TEMP' returns the correct result but UserProfileSettings
> default settingAt: 'tmpDir' returns an empty string ....
>
>
> st> (FileStream open: 'http://www.gnu.org/' mode: FileStream read) contents
> (FileStream open: 'http://www.gnu.org/' mode: FileStream read) contents
> Object: FileStream error: could not open http://www.gnu.org/
> SystemExceptions.FileError(Exception)>>signal (ExcHandling.st:254)
> SystemExceptions.FileError class(Exception class)>>signal: (ExcHandling.st:161)
> optimized [] in FileDescriptor class>>openTemporaryFile: (FileDescr.st:152)
> FileStream(FileDescriptor)>>fileOp:with:ifFail: (FileDescr.st:878)
> FileStream class(FileDescriptor class)>>openTemporaryFile: ("Scavenging... 47% r
> eclaimed, done"
> FileDescr.st:153)
> NetClients.URIResolver>>tmpFile (NetClients.star#VFS.ZipFile/URIResolver.st:1309
> )
> NetClients.URIResolver>>doHTTPRequest:onSuccess: (NetClients.star#VFS.ZipFile/UR
> IResolver.st:514)
> NetClients.URIResolver>>requestHttpContents: (NetClients.star#VFS.ZipFile/URIRes
> olver.st:566)
> NetClients.URIResolver>>getHttpContents (NetClients.star#VFS.ZipFile/URIResolver
> .st:503)
> NetClients.URIResolver>>contentsNoSignal (NetClients.star#VFS.ZipFile/URIResolve
> r.st:154)
> [] in NetClients.URIResolver class>>openOn:ifFail: (NetClients.star#VFS.ZipFile/
> URIResolver.st:58)
> BlockClosure>>on:do:on:do: (BlkClosure.st:206)
> NetClients.URIResolver class>>openOn:ifFail: (NetClients.star#VFS.ZipFile/URIRes
> olver.st:63)
> NetClients.URIResolver class>>openStreamOn:ifFail: (NetClients.star#VFS.ZipFile/
> URIResolver.st:74)
> FileStream class(FileDescriptor class)>>open:mode:ifFail: (FileDescr.st:133)
> FileStream class(FileDescriptor class)>>open:mode: (FileDescr.st:111)
> UndefinedObject>>executeStatements (a String:1)
> 292401 byte codes executed
> which took 0.443 seconds (0.160s user+0.020s sys)
> 20179 primitives, percent 6.90
> self returns 89, inst var returns 0, literal returns 0
> 34228 method cache lookups since last cleanup, percent 11.71
> 32705 method cache hits, 1523 misses, 95.55 percent hits
> returned value is nil
>
> 2012/6/15 Paolo Bonzini <[hidden email]>:
>> Il 15/06/2012 12:14, Stefan Krecher ha scritto:
>>> Hi,
>>> thanks for the strace-tip - i noticed that NetClients could not get
>>> loaded - i fixed this, but now gst dies after opening the FileStream
>>> (on Android), here are the last lines of the strace log, i have no
>>> idea what's happening ...
>>
>> Does it still fail _without_ strace?  This looks like a ptrace bug in
>> your Android kernel.
>>
>> Paolo
>
>
>
> --
> Dipl.-Wirtsch.-Inf. Stefan Krecher
> Neulander Str. 17, 27374 Visselhövede
> Tel +49(0)4262 958848
> mobil +49(0)172 3608616
> http://krecher.com



--
Dipl.-Wirtsch.-Inf. Stefan Krecher
Neulander Str. 17, 27374 Visselhövede
Tel +49(0)4262 958848
mobil +49(0)172 3608616
http://krecher.com

_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk