Hi all,
I am working on improving pharo command line as a part of my GSoC project. I have been looking at different current working directory implementations. I have written a blog post on it. It would be of great help, if you can take a look and give your feedback. Rajula |
Thanks Rajula :) This is cool! On Wed, May 17, 2017 at 1:38 PM, Rajula Vineet <[hidden email]> wrote: Hi all,
|
Definitely. I read that you had a crash and you didn't know why. It is a good idea to run pharo under gdb so you can do a bt (backtrace) and see where it bombed. You can inspect parameters etc. Usually this is revealing of the problem when I do like that. Check http://stackoverflow.com/questions/6121094/how-do-i-run-a-program-with-commandline-args-using-gdb-within-a-bash-script Like gdb -ex=r --args pharo-vm/pharo Pharo.image (not sure this is all right, but you'll figure it out). I also like to use a debug or assert VM so that I get all debugging symbols information. Alternatively, connect to a running Pharo with gdb -p PID I usually do that from something like Code::Blocks with an assert VM + source code around for whatever library I am trying to use from UFFI. Works nicely. Especially when you put a breakpoint before a crashing site, allowing you to see the stackframes etc. With gdb command line, it is worth knowing about frames: http://www.delorie.com/gnu/docs/gdb/gdb_44.html Namaste, Phil On Wed, May 17, 2017 at 2:08 PM, Guillermo Polito <[hidden email]> wrote:
|
In reply to this post by Rajula Vineet
On Wednesday 17 May 2017 05:08 PM, Rajula Vineet wrote:
> Hi all, > > I am working on improving pharo command line as a part of my GSoC project. I > have been looking at different current working directory implementations. I > have written a blog post > <https://vineetreddy.wordpress.com/2017/05/17/pwd-vs-getcwd/> on it. It > would be of great help, if you can take a look and give your feedback. Vineet, Don't depend on getenv(). It is the parent (e.g. sh) which sets PWD to the current working directory before exec-ing your program. When a child process is spawned, the parent can decide not to pass this down to child. e.g. $ env -u PWD ./try Or, if the child process changes its working directory using chdir(), PWD will not change. e.g. --- try.c --- #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <limits.h> int main(int argc, char *argv[]) { char cwd[PATH_MAX]; for(;;) { if (getcwd(cwd, sizeof(cwd)) != NULL) printf("getcwd: %s\n", cwd); else perror("getcwd() error"); printf("PWD: %s\n", getenv("PWD")); if (argv[1]) { printf("chdir %s\n", argv[1]); chdir(argv[1]); argc--; argv++; } else break; } return 0; } ------- Regards .. Subbu |
In reply to this post by Rajula Vineet
On Wed, May 17, 2017 at 7:38 PM, Rajula Vineet <[hidden email]> wrote:
> Hi all, > > I am working on improving pharo command line as a part of my GSoC project. I > have been looking at different current working directory implementations. I > have written a blog post > <https://vineetreddy.wordpress.com/2017/05/17/pwd-vs-getcwd/> on it. It > would be of great help, if you can take a look and give your feedback. > > Rajula I'm not sure what value you might gain from it, but it may be interesting to review... https://github.com/lattera/freebsd/blob/master/bin/pwd/pwd.c (FreeBSD is better to review at since its license is more permissive than Linux) ----- Back when I was using Pharo on Windows, I was involved in some discussions regarding the semantics of working directories. These weren't brought to a conclusion and remain open questions... FileSystem on Windows should maintain per drive current working directory https://pharo.fogbugz.com/f/cases/13094 Windows FileSystem '\test\bar' not an absolute path http://forum.world.st/Windows-FileSystem-test-bar-not-an-absolute-path-td4748378.html#a4748379 Strange Validation with issue 15820 http://forum.world.st/Strange-Validation-with-issue-15820-td4845673.html#a4845863 ----- Finally some grammar feedback... where you say... Implementation: buffer:= String new:100. better might be... Usage: buffer:= String new:100. The implementation would be the method above it ?? cheers -ben |
In reply to this post by philippeback
Hi Phil, Hi Rajula,
pharo-vm/pharo -gdb Pharo.image
|
In reply to this post by Rajula Vineet
This super important! We should be able to use Pharo to write script!!! On Wed, May 17, 2017 at 1:38 PM, Rajula Vineet <[hidden email]> wrote: Hi all, |
Free forum by Nabble | Edit this page |