about file permissions

Q&A's, tips, howto's
Locked
danil
Posts: 4
Joined: Wed Jun 09, 2004 6:48 am

about file permissions

Post by danil »

Hi, all and thanks Lutz for a great software.
I have a slightly funny behaviour of newlisp on FreeBSD - it creates files with execution flags. Is there any intention behind this or may be I'm doing something wrong?

Code: Select all

%newlisp
newLISP v8.0.6 Copyright (c) 2004 Lutz Mueller. All rights reserved.

> (write-file "test" "test") (exit)
4%ls -l test
-rwxr-xr-x  1 danil  wheel  4  9 июн 10:50 test

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

Welcome to the group Danil! On Linux/BSD and other Unix 'write-file' by default uses 0777 (all flags turned on) masked by the usermask which would be:

(& 0777 (~ 022)) => 493 => 0755 => -rwxr-xr-x


You could use:

(! "chmod 644 test")

or you could change the usermask on your system with the Unix command umask.

Lutz

danil
Posts: 4
Joined: Wed Jun 09, 2004 6:48 am

Post by danil »

Thanks, Lutz
Another question - how do folks develop moderate sized programs in newLisp, what environment are you using, etc? newlisp-tk is very handy when creating small snippets (I'm used to Smalltalk, but it's definitely overkill for scripting), but I found a bit bothering to gather these pieces together (although "save context" helps a lot). What are patterns here?

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

I use newlisp-tk rarely and only for trying out small functions etc. or when I do statistical analysis together with Gnuplot. When I develop web scripts, which is what I mostly do with newLISP, I use a text editor with parenthesis matching (vi, JEdit etc) and the plain newlisp.exe executable.

Frequently I just log into my web site server with SSH/Telnet and use vi to develop scripts and test them directly with the browser, and with equal frequency I use newlisp-IDE to develop/try out code portions directly on the webserver via the browser. newlisp-IDE is also good for keeping/maintaining a library of code portions and have it available wherever I can find a computer with Internet connection.

Besides web stuff I have lots of other scripts running on nuevatec.com /newlisp.org: cron jobs and other server admin stuff, Bayes spam filtering etc all scripted in newlisp. My web server host runs FreeBSD.

Lutz

nigelbrown
Posts: 429
Joined: Tue Nov 11, 2003 2:11 am
Location: Brisbane, Australia

Post by nigelbrown »

I've not written 'moderate' size programs but when converting a C program to newlisp
for the pdf generating module I found Vim (see www.vim.org) in the GUI version
good to work with . It flashes matching brackets - I found this a big help.
Nigel

danil
Posts: 4
Joined: Wed Jun 09, 2004 6:48 am

Post by danil »

Ok (I'm using vim as all-purpose editor too).
So one should go through edit-quit-run cycle (or invoke edit from newlisp?). It seems that I simply need some practice to make less errors and to find them quickly. newlisp is so nicelly engineered that it's possible to memorize almost the whole library and it's the first lisp that don't seem allien to me :)

nigelbrown
Posts: 429
Joined: Tue Nov 11, 2003 2:11 am
Location: Brisbane, Australia

Post by nigelbrown »

Using vim I have the tk/tcl gui running, save from vim (no need to quit vim), switch to gui and push button for reload last source - if I fiddle with some defines interactively in the gui (which is what lisp is good at) I then cut and paste the improved code back into vim.

Nigel

Locked