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 -- View this message in context: http://forum.world.st/Current-working-directory-tp4947453.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
Thanks Rajula :) This is cool! On Wed, May 17, 2017 at 1:38 PM, Rajula Vineet <Vineet.Reddy@iiitb.org> 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
-- View this message in context: http://forum.world.st/Current- working-directory-tp4947453.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
-- Guille Polito Research Engineer French National Center for Scientific Research - *http://www.cnrs.fr* <http://www.cnrs.fr> *Web:* *http://guillep.github.io* <http://guillep.github.io> *Phone: *+33 06 52 70 66 13
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-comma... 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 <guillermopolito@gmail.com
wrote:
Thanks Rajula :)
This is cool!
On Wed, May 17, 2017 at 1:38 PM, Rajula Vineet <Vineet.Reddy@iiitb.org> 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
-- View this message in context: http://forum.world.st/Current- working-directory-tp4947453.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
--
Guille Polito
Research Engineer
French National Center for Scientific Research - *http://www.cnrs.fr* <http://www.cnrs.fr>
*Web:* *http://guillep.github.io* <http://guillep.github.io>
*Phone: *+33 06 52 70 66 13 <+33%206%2052%2070%2066%2013>
Hi Phil, Hi Rajula,
On May 17, 2017, at 5:56 AM, "phil@highoctane.be" <phil@highoctane.be> wrote:
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-comma...
Like
gdb -ex=r --args pharo-vm/pharo Pharo.image
(not sure this is all right, but you'll figure it out).
Newer versions of the launch script take --gdb as an argument so you can simply say pharo-vm/pharo -gdb Pharo.image
I also like to use a debug or assert VM so that I get all debugging symbols information.
+1
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 <guillermopolito@gmail.com> wrote: Thanks Rajula :)
This is cool!
On Wed, May 17, 2017 at 1:38 PM, Rajula Vineet <Vineet.Reddy@iiitb.org> 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 -- View this message in context: http://forum.world.st/Current-working-directory-tp4947453.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com. --
Guille Polito
Research Engineer French National Center for Scientific Research - http://www.cnrs.fr
Web: http://guillep.github.io Phone: +33 06 52 70 66 13
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
On Wed, May 17, 2017 at 7:38 PM, Rajula Vineet <Vineet.Reddy@iiitb.org> 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-td474... Strange Validation with issue 15820 http://forum.world.st/Strange-Validation-with-issue-15820-td4845673.html#a48... ----- 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
This super important! We should be able to use Pharo to write script!!! On Wed, May 17, 2017 at 1:38 PM, Rajula Vineet <Vineet.Reddy@iiitb.org> 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
-- View this message in context: http://forum.world.st/Current- working-directory-tp4947453.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
participants (7)
-
Ben Coman -
Eliot Miranda -
Guillermo Polito -
K K Subbu -
phil@highoctane.be -
Rajula Vineet -
Stephane Ducasse