Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #60925 > unrolled thread

SwiftForth `requires` hanging

Started bychristopherdumas@gmail.com
First post2017-06-17 15:12 -0700
Last post2017-06-18 06:23 -0700
Articles 12 — 3 participants

Back to article view | Back to comp.lang.forth


Contents

  SwiftForth `requires` hanging christopherdumas@gmail.com - 2017-06-17 15:12 -0700
    Re: SwiftForth `requires` hanging Julian Fondren <julian.fondren@gmail.com> - 2017-06-17 15:35 -0700
      Re: SwiftForth `requires` hanging christopherdumas@gmail.com - 2017-06-17 15:54 -0700
        Re: SwiftForth `requires` hanging Julian Fondren <julian.fondren@gmail.com> - 2017-06-17 16:01 -0700
          Re: SwiftForth `requires` hanging christopherdumas@gmail.com - 2017-06-17 16:22 -0700
            Re: SwiftForth `requires` hanging Julian Fondren <julian.fondren@gmail.com> - 2017-06-17 16:28 -0700
              Re: SwiftForth `requires` hanging christopherdumas@gmail.com - 2017-06-17 16:41 -0700
                Re: SwiftForth `requires` hanging Julian Fondren <julian.fondren@gmail.com> - 2017-06-17 17:08 -0700
                Re: SwiftForth `requires` hanging "HAA" <someone@microsoft.com> - 2017-06-18 11:15 +1000
                  Re: SwiftForth `requires` hanging christopherdumas@gmail.com - 2017-06-17 18:26 -0700
                    Re: SwiftForth `requires` hanging Julian Fondren <julian.fondren@gmail.com> - 2017-06-17 20:03 -0700
                      Re: SwiftForth `requires` hanging christopherdumas@gmail.com - 2017-06-18 06:23 -0700

#60925 — SwiftForth `requires` hanging

Fromchristopherdumas@gmail.com
Date2017-06-17 15:12 -0700
SubjectSwiftForth `requires` hanging
Message-ID<cd4e4924-6a9b-481f-ade0-fc930ad6b404@googlegroups.com>
Hi guys, so I recently moved to a new Mac and reinstalled SwiftForth (the free trial) just like the readme says except to "/usr/local/bin." Anyway, when I require a file using "requires file.sf" it hangs indefinitely, not even saying "File not found." When I try with the absolute path, same thing. Also, when I use it by going to the command-line and doing "sf file.sf" it enters, but when I try "locate word-from-file" it says "Source file not available." Why is this? It worked perfectly fine before I moved to my new computer. Thanks!
I'm running Mac OS X Sierra on both machines.

[toc] | [next] | [standalone]


#60928

FromJulian Fondren <julian.fondren@gmail.com>
Date2017-06-17 15:35 -0700
Message-ID<8d3aa68b-26d7-4497-80cb-a6b41f90105b@googlegroups.com>
In reply to#60925
On Saturday, June 17, 2017 at 5:12:23 PM UTC-5, christop...@gmail.com wrote:
> Hi guys, so I recently moved to a new Mac and reinstalled SwiftForth (the free trial) just like the readme says except to "/usr/local/bin." Anyway, when I require a file using "requires file.sf" it hangs indefinitely, not even saying "File not found." When I try with the absolute path, same thing. Also, when I use it by going to the command-line and doing "sf file.sf" it enters, but when I try "locate word-from-file" it says "Source file not available." Why is this? It worked perfectly fine before I moved to my new computer. Thanks!
> I'm running Mac OS X Sierra on both machines.

If you put 'sf' in /usr/local/bin, where do you put the rest of the
files? SwiftForth loads its own files relative to %SwiftForth , which
is probably based on the location of 'sf' itself. For example if I
trace an evaluation copy of sf asked to load fpmath.f and then go
away, it does this:

  stat("fpmath.f\0", 0xBFFF7880, 0x101)          = -1 Err#2

Not in the current directory,

  open_nocancel(".\0", 0x0, 0xBFFF7698)          = 3 0
  fstat64(0x3, 0xBFFF76E8, 0xBFFF7698)           = 0 0
  fcntl_nocancel(0x3, 0x32, 0xFFFFFFFFBFFF7270)          = 0 0
  close_nocancel(0x3)            = 0 0
  stat64("/Users/jfondren\0", 0xBFFF7678, 0xFFFFFFFFBFFF7270)
  = 0 0

The directory I was in when I ran the command, not sure why this is
checked here.

  chdir("/Users/jfondren/z/SwiftForth/lib\0", 0xBFFF7678,
  0xFFFFFFFFBFFF7270)            = 0 0

sf blindly jumps to $location_of_binary/../../lib and continues
looking there.

You can get output like that with this command in OSX:

  sudo dtruss requires fpmath.f bye 2>&1|grep -v 'dtrace: error'

Which may help with the hang.

[toc] | [prev] | [next] | [standalone]


#60929

Fromchristopherdumas@gmail.com
Date2017-06-17 15:54 -0700
Message-ID<04610d18-b790-40b2-9c78-5a80311b7aa0@googlegroups.com>
In reply to#60928
Okay, so I've added my SwiftForth folder to my path and deleted the symlinks to my /usr/local/bin, and it can now successfully require files. However, it still says "Source file not available." I'm now doing exactly what I was doing on my old computer. Any guesses as to what I'm missing? Also, in answer to your answer, I'm not loading system files like fpmath (those load fine) I'm loading my own code.

[toc] | [prev] | [next] | [standalone]


#60930

FromJulian Fondren <julian.fondren@gmail.com>
Date2017-06-17 16:01 -0700
Message-ID<bef516d1-34b2-4c12-9022-04a5ab06261f@googlegroups.com>
In reply to#60929
On Saturday, June 17, 2017 at 5:54:16 PM UTC-5, christop...@gmail.com wrote:
> Okay, so I've added my SwiftForth folder to my path and deleted the symlinks to my /usr/local/bin, and it can now successfully require files. However, it still says "Source file not available." I'm now doing exactly what I was doing on my old computer. Any guesses as to what I'm missing? Also, in answer to your answer, I'm not loading system files like fpmath (those load fine) I'm loading my own code.

No idea. Put the thing that fails on a command line with dtruss and
see what's going on. Remember to quote it if the shell would see
different words than Forth would.

  sudo dtruss sf include myfile.fs locate blah bye 2>&1| grep -v 'dtrace: error'

[toc] | [prev] | [next] | [standalone]


#60931

Fromchristopherdumas@gmail.com
Date2017-06-17 16:22 -0700
Message-ID<71e4d11f-b118-47ee-baa6-3e7f3f0b784d@googlegroups.com>
In reply to#60930
I ran that with my command and file, but I'm not really sure what to make of it:

SYSCALL(args) 		 = return

include PE.fs locate gcd bye File not found
open("/dev/dtracehelper\0", 0x2, 0xBFFFEA00)		 = 3 0
ioctl(0x3, 0x80086804, 0xBFFFE980)		 = 0 0
close(0x3)		 = 0 0
thread_selfid(0x3, 0x80086804, 0xBFFFE980)		 = 395677 0
bsdthread_register(0xA173C828, 0xA173C804, 0x1000)		 = 1073741919 0
mprotect(0x1006000, 0x44, 0x1)		 = 0 0
mprotect(0x1008000, 0x1000, 0x0)		 = 0 0
mprotect(0x1014000, 0x1000, 0x0)		 = 0 0
mprotect(0x1015000, 0x1000, 0x0)		 = 0 0
mprotect(0x1021000, 0x1000, 0x0)		 = 0 0
mprotect(0x1022000, 0x1000, 0x1)		 = 0 0
mprotect(0x1006000, 0x44, 0x3)		 = 0 0
mprotect(0x1006000, 0x44, 0x1)		 = 0 0
ulock_wake(0x1, 0xBFFFE478, 0x0)		 = -1 Err#2
issetugid(0x1, 0xBFFFE478, 0x0)		 = 0 0
getpid(0x1, 0xBFFFE478, 0x0)		 = 14647 0
stat64("/AppleInternal/XBS/.isChrooted\0", 0xBFFFE398, 0x0)		 = -1 Err#2
stat64("/AppleInternal\0", 0xBFFFE408, 0x0)		 = -1 Err#2
csops(0x3937, 0x7, 0xBFFFDEC4)		 = -1 Err#22
ulock_wake(0x1, 0xBFFFE410, 0x0)		 = -1 Err#2
csops(0x3937, 0x7, 0xBFFFD744)		 = -1 Err#22
stat64("libpthread.dylib\0", 0xBFFF7078, 0xBFFFD744)		 = -1 Err#2
stat64("/Users/christopherdumas/lib/libpthread.dylib\0", 0xBFFF7438, 0xBFFFD744)		 = -1 Err#2
stat64("/\0", 0xBFFF53B0, 0xBFFFD744)		 = 0 0
getattrlist("/Users\0", 0x10A8D54, 0xBFFF6C98)		 = 0 0
getattrlist("/Users/christopherdumas\0", 0x10A8D54, 0xBFFF6C98)		 = 0 0
getattrlist("/Users/christopherdumas/lib\0", 0x10A8D54, 0xBFFF6C98)		 = -1 Err#2
stat64("/Users/christopherdumas/lib\0", 0xBFFF7008, 0xBFFF6C98)		 = -1 Err#2
stat64("/usr/local/lib/libpthread.dylib\0", 0xBFFF7448, 0xBFFF6C98)		 = -1 Err#2
getattrlist("/usr\0", 0x10A8D54, 0xBFFF6CA8)		 = 0 0
getattrlist("/usr/local\0", 0x10A8D54, 0xBFFF6CA8)		 = 0 0
getattrlist("/usr/local/lib\0", 0x10A8D54, 0xBFFF6CA8)		 = 0 0
getattrlist("/usr/local/lib/libpthread.dylib\0", 0x10A8D54, 0xBFFF6CA8)		 = -1 Err#2
stat64("/usr/local/lib/libpthread.dylib\0", 0xBFFF7018, 0xBFFF6CA8)		 = -1 Err#2
stat64("/usr/lib/libpthread.dylib\0", 0xBFFF7458, 0xBFFF6CA8)		 = 0 0
stat64("libc.dylib\0", 0xBFFF7078, 0xBFFF6CA8)		 = -1 Err#2
stat64("/Users/christopherdumas/lib/libc.dylib\0", 0xBFFF7448, 0xBFFF6CA8)		 = -1 Err#2
getattrlist("/Users\0", 0x10A8D54, 0xBFFF6CA8)		 = 0 0
getattrlist("/Users/christopherdumas\0", 0x10A8D54, 0xBFFF6CA8)		 = 0 0
getattrlist("/Users/christopherdumas/lib\0", 0x10A8D54, 0xBFFF6CA8)		 = -1 Err#2
stat64("/Users/christopherdumas/lib\0", 0xBFFF7018, 0xBFFF6CA8)		 = -1 Err#2
stat64("/usr/local/lib/libc.dylib\0", 0xBFFF7458, 0xBFFF6CA8)		 = -1 Err#2
getattrlist("/usr\0", 0x10A8D54, 0xBFFF6CB8)		 = 0 0
getattrlist("/usr/local\0", 0x10A8D54, 0xBFFF6CB8)		 = 0 0
getattrlist("/usr/local/lib\0", 0x10A8D54, 0xBFFF6CB8)		 = 0 0
getattrlist("/usr/local/lib/libc.dylib\0", 0x10A8D54, 0xBFFF6CB8)		 = -1 Err#2
stat64("/usr/local/lib/libc.dylib\0", 0xBFFF7028, 0xBFFF6CB8)		 = -1 Err#2
stat64("/usr/lib/libc.dylib\0", 0xBFFF7458, 0xBFFF6CB8)		 = 0 0
sigaction(0x4, 0xBFFF7AD0, 0x0)		 = 0 0
sigaction(0x8, 0xBFFF7AD0, 0x0)		 = 0 0
sigaction(0xA, 0xBFFF7AD0, 0x0)		 = 0 0
sigaction(0xB, 0xBFFF7AD0, 0x0)		 = 0 0
sigaction(0x2, 0xBFFF7AD0, 0x0)		 = 0 0
stat("/\0", 0xBFFF67D8, 0x0)		 = 0 0
getattrlist("/Users\0", 0xA15E9AD4, 0xBFFF75A8)		 = 0 0
getattrlist("/Users/christopherdumas\0", 0xA15E9AD4, 0xBFFF75A8)		 = 0 0
getattrlist("/Users/christopherdumas/SwiftForth\0", 0xA15E9AD4, 0xBFFF75A8)		 = 0 0
getattrlist("/Users/christopherdumas/SwiftForth/bin\0", 0xA15E9AD4, 0xBFFF75A8)		 = 0 0
getattrlist("/Users/christopherdumas/SwiftForth/bin/osx\0", 0xA15E9AD4, 0xBFFF75A8)		 = 0 0
getattrlist("/Users/christopherdumas/SwiftForth/bin/osx/sf\0", 0xA15E9AD4, 0xBFFF75A8)		 = 0 0
ioctl(0x0, 0x402C7413, 0x95EF)		 = 0 0
ioctl(0x0, 0x802C7414, 0x9626)		 = 0 0
sigaction(0x13, 0xBFFF7A80, 0x0)		 = 0 0
open_nocancel("/Users/christopherdumas/.SwiftForth_history\0", 0x20000, 0x0)		 = 3 0
lseek(0x3, 0x0, 0x1)		 = 0 0
lseek(0x3, 0x3, 0x0)		 = 3 0
lseek(0x3, 0x0, 0x1)		 = 3 0
lseek(0x3, 0x13, 0x0)		 = 19 0
lseek(0x3, 0x0, 0x1)		 = 19 0
lseek(0x3, 0x1E, 0x0)		 = 30 0
lseek(0x3, 0x0, 0x1)		 = 30 0
lseek(0x3, 0x21, 0x0)		 = 33 0
lseek(0x3, 0x0, 0x1)		 = 33 0
lseek(0x3, 0x29, 0x0)		 = 41 0
lseek(0x3, 0x0, 0x1)		 = 41 0
lseek(0x3, 0x31, 0x0)		 = 49 0
lseek(0x3, 0x0, 0x1)		 = 49 0
lseek(0x3, 0x3C, 0x0)		 = 60 0
lseek(0x3, 0x0, 0x1)		 = 60 0
lseek(0x3, 0x47, 0x0)		 = 71 0
lseek(0x3, 0x0, 0x1)		 = 71 0
lseek(0x3, 0x4A, 0x0)		 = 74 0
lseek(0x3, 0x0, 0x1)		 = 74 0
lseek(0x3, 0x77, 0x0)		 = 119 0
lseek(0x3, 0x0, 0x1)		 = 119 0
lseek(0x3, 0x86, 0x0)		 = 134 0
lseek(0x3, 0x0, 0x1)		 = 134 0
lseek(0x3, 0xB3, 0x0)		 = 179 0
lseek(0x3, 0x0, 0x1)		 = 179 0
lseek(0x3, 0xC2, 0x0)		 = 194 0
lseek(0x3, 0x0, 0x1)		 = 194 0
lseek(0x3, 0xCE, 0x0)		 = 206 0
lseek(0x3, 0x0, 0x1)		 = 206 0
lseek(0x3, 0xDF, 0x0)		 = 223 0
lseek(0x3, 0x0, 0x1)		 = 223 0
lseek(0x3, 0xF1, 0x0)		 = 241 0
lseek(0x3, 0x0, 0x1)		 = 241 0
lseek(0x3, 0x11E, 0x0)		 = 286 0
lseek(0x3, 0x0, 0x1)		 = 286 0
lseek(0x3, 0x123, 0x0)		 = 291 0
lseek(0x3, 0x0, 0x1)		 = 291 0
lseek(0x3, 0x132, 0x0)		 = 306 0
lseek(0x3, 0x0, 0x1)		 = 306 0
lseek(0x3, 0x135, 0x0)		 = 309 0
lseek(0x3, 0x0, 0x1)		 = 309 0
lseek(0x3, 0x13A, 0x0)		 = 314 0
lseek(0x3, 0x0, 0x1)		 = 314 0
lseek(0x3, 0x13D, 0x0)		 = 317 0
lseek(0x3, 0x0, 0x1)		 = 317 0
lseek(0x3, 0x142, 0x0)		 = 322 0
lseek(0x3, 0x0, 0x1)		 = 322 0
lseek(0x3, 0x171, 0x0)		 = 369 0
lseek(0x3, 0x0, 0x1)		 = 369 0
lseek(0x3, 0x182, 0x0)		 = 386 0
lseek(0x3, 0x0, 0x1)		 = 386 0
lseek(0x3, 0x185, 0x0)		 = 389 0
lseek(0x3, 0x0, 0x1)		 = 389 0
lseek(0x3, 0x18B, 0x0)		 = 395 0
lseek(0x3, 0x0, 0x1)		 = 395 0
lseek(0x3, 0x196, 0x0)		 = 406 0
lseek(0x3, 0x0, 0x1)		 = 406 0
lseek(0x3, 0x1A7, 0x0)		 = 423 0
lseek(0x3, 0x0, 0x1)		 = 423 0
lseek(0x3, 0x1B5, 0x0)		 = 437 0
lseek(0x3, 0x0, 0x1)		 = 437 0
lseek(0x3, 0x1C6, 0x0)		 = 454 0
lseek(0x3, 0x0, 0x1)		 = 454 0
lseek(0x3, 0x1D7, 0x0)		 = 471 0
lseek(0x3, 0x0, 0x1)		 = 471 0
lseek(0x3, 0x1E8, 0x0)		 = 488 0
lseek(0x3, 0x0, 0x1)		 = 488 0
lseek(0x3, 0x1FB, 0x0)		 = 507 0
lseek(0x3, 0x0, 0x1)		 = 507 0
lseek(0x3, 0x210, 0x0)		 = 528 0
lseek(0x3, 0x0, 0x1)		 = 528 0
close_nocancel(0x3)		 = 0 0
stat("include\0", 0xBFFF7A00, 0x101)		 = -1 Err#2
stat("PE.fs\0", 0xBFFF7940, 0x101)		 = -1 Err#2

[toc] | [prev] | [next] | [standalone]


#60932

FromJulian Fondren <julian.fondren@gmail.com>
Date2017-06-17 16:28 -0700
Message-ID<b747e3a2-ee45-43ed-bdb3-fa765d71677a@googlegroups.com>
In reply to#60931
On Saturday, June 17, 2017 at 6:22:55 PM UTC-5, christop...@gmail.com wrote:
> I ran that with my command and file, but I'm not really sure what to make of it:
...
> stat("PE.fs\0", 0xBFFF7940, 0x101)             = -1 Err#2

PE.fs isn't in the current directory. -1 just means 'error', but the the '#2'
there is 'No such file or directory'.

INCLUDE isn't like REQUIRES which has a list of places sf will look; INCLUDE
just looks exactly where you ask. If PE.fs is in some other directory, like
lib/blah or /Users/me/lib/blah , you need to say

  include lib/blah/PE.fs
  include /Users/me/lib/blah/PE.fs

[toc] | [prev] | [next] | [standalone]


#60933

Fromchristopherdumas@gmail.com
Date2017-06-17 16:41 -0700
Message-ID<7b091bbf-0d5d-4f80-b442-2607c25cd005@googlegroups.com>
In reply to#60932
I could make that much out, but I already know it can't find the source file. Also, I'm using requires right now. Also, when I run the sf command the PE.fs file is in the current (same) directory.

[toc] | [prev] | [next] | [standalone]


#60934

FromJulian Fondren <julian.fondren@gmail.com>
Date2017-06-17 17:08 -0700
Message-ID<79466dcd-4042-45b7-9c2f-9392d7c67254@googlegroups.com>
In reply to#60933
On Saturday, June 17, 2017 at 6:41:08 PM UTC-5, christop...@gmail.com wrote:
> I could make that much out, but I already know it can't find the source file. Also, I'm using requires right now. Also, when I run the sf command the PE.fs file is in the current (same) directory.

OSX doesn't seem to agree with you. Show some commands demonstrating this. Like,

  pwd

  sf pwd bye

  ls -ld PE.fs; sf include PE.fs bye

  ls -ld $PWD/PE.fs; sf include $PWD/PE.fs bye

  perl -le 'open my $x, "PE.fs" or die $!'

[toc] | [prev] | [next] | [standalone]


#60936

From"HAA" <someone@microsoft.com>
Date2017-06-18 11:15 +1000
Message-ID<oi4k6g$7pf$1@gioia.aioe.org>
In reply to#60933
christopherdumas@gmail.com wrote:
> I could make that much out, but I already know it can't find the source file. Also, I'm
> using requires right now. Also, when I run the sf command the PE.fs file is in the
> current (same) directory.

No experience with Mac but Windows sf has the command DIR which will
show the default directory where it expects to find INCLUDEd files.

The complaint about 'requires hanging' rather than displaying 'file not found'
I would call a bug :)


[toc] | [prev] | [next] | [standalone]


#60937

Fromchristopherdumas@gmail.com
Date2017-06-17 18:26 -0700
Message-ID<f09c3c3b-a34e-4c4c-b8f6-1b46487c36d8@googlegroups.com>
In reply to#60936
Thanks for your patience with a forth noob, Julian. Here is the output of running those commands:
/Users/christopherdumas/forth
/Users/christopherdumas/forth
-rw-r--r--  1 christopherdumas  staff  725 Jun 17 18:22 PE.fs   ok
-rw-r--r--  1 christopherdumas  staff  725 Jun 17 18:22 /Users/christopherdumas/forth/PE.fs  ok


Note that the perl command outputs nothing.

[toc] | [prev] | [next] | [standalone]


#60940

FromJulian Fondren <julian.fondren@gmail.com>
Date2017-06-17 20:03 -0700
Message-ID<ab1eb817-65cc-4104-8766-892e2ae9c33d@googlegroups.com>
In reply to#60937
On Saturday, June 17, 2017 at 8:26:18 PM UTC-5, christop...@gmail.com wrote:
> Thanks for your patience with a forth noob, Julian. Here is the output of running those commands:
> /Users/christopherdumas/forth
> /Users/christopherdumas/forth
> -rw-r--r--  1 christopherdumas  staff  725 Jun 17 18:22 PE.fs   ok
> -rw-r--r--  1 christopherdumas  staff  725 Jun 17 18:22 /Users/christopherdumas/forth/PE.fs  ok
> 
> 
> Note that the perl command outputs nothing.

OK. All that suggests the file is in the current directory, as do the sf
commands, since they don't look like this:

  $ sf include nothere.fs

  include nothere.fs File not found
  Exit? (Yes/No/Edit) 

REQUIRES works very similarly: if you pass it an exact name to use it just
calls INCLUDED .  If the given file (plus .f) doesn't as given then REQUIRES
chdir's to sf's lib directory and tries again (this is a little bit lame -
SwiftForth is punting on more capable path handling at the cost of extra
syscalls).

But I don't get an error with any invocation of requires either. This works
fine for a file in the current directory:

  $ echo '.( hello world) bye' > hello.fs
  $ echo '.( bye world) bye' > hello.f
  $ sf requires hello
  bye world
  $ sf requires hello.fs
  hello world

Same on Linux and OSX and an eval version on OSX. That the eval version on OSX
works, means that this probably isn't something weird where SwiftForth is
unable to return to its previous directory after trying to load the file in a
library path.

Are you sure that nothing's changed since you posted the dtruss output?

If you're having problems please provide a complete example that shows it. You
could even go as far as

  Step 1. download and extract SwiftForth eval

But a reliable one-liner starting from the shell should do, as with the
examples above.

[toc] | [prev] | [next] | [standalone]


#60965

Fromchristopherdumas@gmail.com
Date2017-06-18 06:23 -0700
Message-ID<2d6096c0-6481-4f37-b14c-44144e30781f@googlegroups.com>
In reply to#60940
Um, well, this is embarrassing, but... I left everything alone overnight (that I know of) but it's working now. I don't know why. I was giving it the absolute path before while now I'm giving it just the file name, that could be it. Thanks for your help! :P

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.forth


csiph-web