| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Within the same clause, permissions given by ugo must refer to
the unaltered permissions, before the target bits were masked
out, otherwise self-assignment like o=o just clears the
permissions. The other self-referential perm is X: it checks
for existing x permissions. That works with the current
value.
* sysif.c (chmod_wrap): Keep the old permissions in a new loop
variable called oldm. The u, g and o perms refer to oldm
rather than to the updated value in cmode. When we hit a
comma, we update oldm to the current value. The code for
this is now in one place with a goto.
* tests/018/chmod.tl: New test case that fails in the
absence of this fix. Test cases confirming that X
refers to the current permissions.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* sysif.c (chmod_wrap): The chm_comma state is transitioned to
after seeing a right hand side u, g or o. These do not combine
with other letters, so ch_comma expects a comma after which a
new permission clause we start,. Therefore the srcm and who
variables must be rest. It's also a good idea to continue the
loop.
* tests/018/chmod.tl: New test case which exposed
the above issue.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* sysif.c (chmod_wrap): Again, related to the = operator, we
must not punch a hole in the suid and sgid bits for all
non-directory objects. This was based on a misinterpretation
of some coreutils documentation, and doesn't match the
actual behavior. Rather, if the owner is a target (including
implicitly) then we mask out suid; and if the group owner is a
targe, then we mask out sgid. Thus when we are doing a
permission set not targetting the owner we don't touch suid,
and similarly for the group owner and setgid.
* tests/018/chmod.tl: Failed test diagnostics now
identify which mode string was used.
Some existing tests involving the suid/sgid bits
have to be revised because this commit reflects
a correction in the requirements. One new test is added.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* sysif.c (chmod_wrap): When processing set (=), only punch a
hole in the target permission area once per clause, so as not
to clobber previously set modes. We do this by checking for
the chm_perm state. Whenever '=' is processed, the state machine
enters into that state; when any permission letter is then
processed, it transitions out of that state. This gets the
"u=rwsx" test to pass.
* tests/018/chmod.tl: New tests.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The chmod fixes in the previous several commits were
caught by this.
* Makefile (tst/tests/018/chmod.ok): Set up TXR_ARGS for this
test to give it the location of the temporary file to use
as the object for testing permissions.
(tst/tests/018): Disable TXR_DBG_OPTS for new directory.
* tests/018/chmod.tl: New file.
* tests/018/chmod.expected: Likewise.
* tests/perm.tl: Likewise.
|
|
|
|
|
|
|
|
|
| |
* sysif.c (chmod_wrap): The umask logic is not activating
after the first iteration through the loop, because when who
is zero, we clobber it by adding the bits for u, g, and o.
Then on subsequent iterations, who is no longer zero.
Instead, let us leave the value of who alone, and in
all the relevant places, check for it being zero.
|
|
|
|
|
| |
* sysif.c (chmod_wrap): Clear the sticky bit from the right
variable: cmode rather than bits.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/getput.tl (file-place-buf): Instead of "r+"
mode, use the new "mb" mode which will create the file without
truncating it, and open for write mode. Also, bugfix: the
"b" option was missing.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Quite surprisingly ISO C lacks a way in fopen to open a file
for writing such that it is not truncated if it already
exists, and not opened in append mode.
(But you will be glad to know that ISO C is adding incredibly
useful features in this area, like Microsoft's fopen_s!)
Let us add modes "m" and "m+" which will be like "w" and "w+",
but without the truncation to zero length (no O_TRUNC
is passed to open).
* stream.c (w_fopen_mode): New static function.
(open_file, open_tail, tail_strategy): Use w_fopen_mode
instead of directly calling w_fopen.
(do_parse_mode): Handle 'm' and set new notrunc flag.
* stream.h (struct stdio_mode): New member, notrunc flag.
(stdio_mode_init_blank, stdio_mode_init_r,
stdio_mode_init_rpb): Initializer macros updated to include
initializer for notrunc flag.
* txr.1: Documented "m" mode.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Like file-put-buf but doesn't overwrite the file.
* lisplib.c (getput_set_entries): New autoload for
file-place-buf.
* share/txr/stdlib/getput.tl (file-put-buf): New
argument for seeking into the file.
(file-place-buf): New function.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* buf.c (buf_grow): Function removed; logic merged into
buf_do_set_len. The bug fixed is that buf_grow was
initializing just the newly allocated bytes to init_val. The
bytes that must actually be initialized are those which lie
between the old and new length, not in the allocated area.
(make_buf): In make_buf, we don't have to initialize the
entire buffer, but only bytes 0 through len - 1. Now
calloc is only used when the initializing value is zero,
and the buffer's allocation size is the same as the length.
When the length is increase to protrude into the allocated
uninitialized area, buf_do_set_len will now properly
initialize that to the value given at that time.
* txr.1: Update make-buf documentation not to say that
all the bytes of the buffer are initialized.
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/getput.tl (sys:get-buf-common): Take two
more arguments for maximum bytes to read and offset.
Read loop simplified with fill-buf-adjust.
(file-get-buf, command-get-buf): Take two new arguments,
pass though to sys:get-buf-common.
* txr.1: Documented.
|
|
|
|
|
| |
* txr.1: It is wrongly documented that file-get-buf and
comman-get-buf use text streams; they use binary streams.
|
|
|
|
|
|
| |
* txr.1: The fill-buf function returns the position
after the last byte that was read, not the position of
that that last byte.
|
|
|
|
|
|
|
| |
* stream.c (stdio_fill_buf): In the case of EOF, we must not
return zero, but pos. Also, since pos and nread are cnum,
we should use num to convert their sum to val. Converting to
unum doesn't do anything for the overflow situation.
|
|
|
|
|
|
| |
* sysif.c (chmod_wrap): The uw_throw expression contains an
otal format specifier ~o which requires an integer argument;
but the mode can be a string now. Split into two cases.
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes the issue that TXR exits if an exception occurs
during Tab completion in the interactive listener.
This could happen when loading a file fails for whatever
reason, such as a corrupt or incomplete installation
of the library files or whatever.
* parser.c (provide_completions): Set up a catch all handler
here around everything, like we already did in provide_atom.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We can get rid of fstat_wrap entirely and make
the lstat and fstat function bindings point to the same
function.
* parser.c (load_rcfile): Call stat_wrap instead of
fstat_wrap.
* sysif.c (stat_wrap): Static function becomes extern. Useless
forward declaration removed.
(fstat_wrap): Static function removed.
(sysif_init): Bind fstat and lstat to the same function
object.
* sysif.h (fstat_wrap): Declaration removed.
(stat_wrap): Declaration added.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* sysif.c (get_fd): Move this function higher in the file to
avoid forward declarations. The do_fstatt code being moved into
do_stat needs to call it.
(do_stat): Provide stat and fstat functionality in one
function.
(do_fstat): Static function removed.
(fstat_wrap): Call do_stat instead of do_fstat.
* txr.1: Updated.
|
|
|
|
|
|
| |
* txr.1: the Stream Output Limitation section is about the
mechanism to limit output, not about limits of capability;
the word we want is "Limiting".
|
|
|
|
|
| |
* txr.1: Fix reference to a nonexistent stream-fd function;
the correct name is fileno.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The chmod function can now take a string, which uses the same
conventions as the symbolic mode argument of the chmod utility.
* sysif.c (CHM_O, CHM_G, CHM_U): New preprocessor symbols.
(enum chm_state, enum chm_op): New enums.
(chmod_wrap): Allow argument to be a string, and in that case
interpret the chmod symbolic permission language.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (copy_file_set_entries): Add chown-rec and
chmod-rec to list of symbols that trigger auto-load of
copy-file.tl.
* share/txr/stdlib/copy-file.tl (chmod-rec, chown-rec): Neew
functions.
* txr.1: Documented.
|
|
|
|
|
| |
* txr.1: The catch section fails to mention the catch**
operator in the section heading.
|
|
|
|
| |
* txr.1: fix repeated word.
|
|
|
|
|
|
|
|
| |
* txr.1: Fix wrong documentation about defex. It does allow
registration of duplicate relationhips and updates that
do not create cycles. Document a rule that is missing: that
a subtype relationships can't be registered when the opposite
relationship already exists.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On 2009-10-02, prior to TXR 014, I made a change to the c_str
function to allow symbolic arguments, so that c_str(sym) could
be used in the code base instead of c_str(symbol_name(sym)).
This was a bad idea, and is allowing numerous functions that
operate on strings to accept symbols also. That behavior is
not documented and not consistently supported. Ironically, I
completely forgot about this and have been consistently using
symbol_name(sym) anyway. Let us remove this.
Compat support is required because this will break user code
that accidentally depends on this undocumented behavior.
* lib.c (c_str): If the object is type SYM, only return the
symbol_name if compatibility with 231 or older is requested,
otherwise fall through to the error case.
* match.c (dump_var): Fix one case where a symbol is passed
directly to put_string. This fails one of the test cases.
More testing is required to see if any other such cases occur.
* txr.1: New entry in the compatibility notes.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The open-files and open-files* functions are missing a mode
string argument, which makes it impossible to, say, open all
of the files in "rb" mode on a platform where that matters.
* stream.c (open_files, open_files_star): Take mode as a third
optional parameter. If it is present, then pass it to
open_file.
* txr.1: Document mode string parameter for the two functions.
|
|
|
|
| |
* txr.1: Under rename-path, remove-path is wrongly referenced.
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/copy-file.tl (copy-file): Detect that
from-path is a directory before attempting to open it. The
issue is that the open will succeed for a directory, and only
the subsequent read will fail. By that time we have opened
created the target file.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (copy_file_instantiate, copy_file_set_entries):
New static functions.
(lisplib_init): Register auto-load of copy-file.tl via
new functions.
* share/txr/stdlib/copy-file.tl: New file.
* txr.1: New section Unix Filesystem Complex Operations.
Here copy-file, copy-files, copy-path-rec and remove-path-rec
are documented.
|
|
|
|
|
|
|
| |
* unwind.c (uw_late_init): Register retry and skip symbols
as exception subtypes of restart.
* txr.1: Document retry and skip restarts.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The configure command line is now turned into an
executable script called reconfigure which can be invoked to
repeat the config.
* Makefile (distclean): Whether in a configured or state or
not, try to remove reconfigure. In the configured state, don't
remove config.log. (If distclean is invoked when not
configured, the config.* pattern will remove config.log).
* configure: rewrite the logic which turns the command line
into text. It is now robust against spaces, quotes and
meta-charaters. Moreover, the printed representation is chosen
according to good heuristics to minimize unnecessary quoting
and escaping. The config line is written into an executable
script called reconfigure. This is now done twice; it is done
immediately, so that we save the command line even if the
configure subsequently fails. A comment is added to
reconfigure indicating that configure didn't succeed. Then
after a successful run through the tests, we save it again,
without the cautionary comment. Help texts updated.
|
|
|
|
|
|
|
| |
* eval.c (eval_init): bugfix: for the functions
package-symbols, package-local-symbols and
package-foreign-symbols, make the package parameter optional,
as is specified in the documentation.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a useful function which supports the use of temporary
packages over the scope of file compilation units.
A file can be read under a temporary package which provides
usefully customized symbol visibility consisting of
an arrangement of symbols from various other packages.
Then, in a single operation, thanks to this new function,
that packag can be deleted and all of its local symbols
(those having been newly interned over the course of the
file) are transferred to some other, more permanent package.
* eval.c (eval_init): merge-delete-package intrinsic
registered.
* lib.c (merge_delete_package): New function.
* lib.h (merge_delete_package): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (compiler comp-catch): Compile
the try expression and the description in the newly extended
environment rather than the original environment. This is
necessary because the compiled code for both of these is
is placed into the frame level corresponding to the new
environment. Other than the level, the only difference between
the two environment is that nenv has a couple of gensyms.
Thus it is hygienic w.r.t. the try and desc code; the extended
environment can safely be used.
|
|
|
|
|
|
| |
* vm.c (do_frame): In frame level mismatch diagnostic,
identify vm descriptor, instruction offset and the expected
and actual level.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The ftw function just returns -1 if, for instance, given a bad
path (nonexistent or no permissions). The documentation also
has issues.
* ftw.c (ftw_wrap): If the return value is -1, convert it to a
file-error using errno_to_file_error and throw a diagnostic
exception. This situation can, of course, arise if the
callback function returns -1, in which case it should prepare
a value in errno.
* txr.1: Return value of callbackfn documented better.
Documented exception throwing behavior, and failed termination
if the callback returns -1.
|
|
|
|
|
|
|
| |
* sysif.c (rmdir_wrap): New static function.
(sysif_init): rmdir intrinsic registered.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
| |
* configure: New configure test for chown, fchown and lchown.
* sysif.c (get_fd): Define for HAVE_CHOWN also.
(do_chown, chown_wrap, lchown_wrap): New functions.
(sysif_init): chown and lchown intrinsics registered.
* txr.1: Documented.
|
|
|
|
|
|
|
| |
* sysif.c (mkdir_nothrow_exists): Return nil in the existence
case, when the object is a directory or a symlink to one.
* txr.1: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* sysif.c (do_stat, do_lstat): Functions relocated before
mkdir_nothrow_exists.
(mkdir_nothrow_exists): In the EEXIST case, call stat on the
object. If it's not a directory or a symlink to a directory,
then do not suppress the error; propagate it to the caller,
where it will become an exception.
* txr.1: Specify the behavior of ensure-dir more precisely:
that it only supresses the existence error for directories
and directory symlinks.
|
|
|
|
|
|
|
| |
* configure: detect mkfifo.
(sysif_init): Register mkfifo intrinsic.
* txr.1: Documented.
|
|
|
|
|
| |
* sysif.c (sysif_init): Fix incorrect registration of mknod,
whose third argument (dev) is documented as optional.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* configure: Detect various functions for setting file
timestamps.
* sysif.c (get_fd): Define this function for use by utimes
also.
(timens, do_utimes): New static functions.
(wrap_utimes, wrap_lutimes): New static functions.
(sysif_init): Register utimes and lutimes intrinsics.
* txr.1: Documented.
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register coded-length intrinsic.
* lib.c (coded_length): New function.
* lib.h (coded_length): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The undimensioned (array <type>) and (zarray <type>) types are
not doing UTF-8 conversion when <type> is char or zchar,
or doing what they are supposed to with the FFI character
types, which is inconsistent from their dimensioned
counterparts.
* ffi.c (ffi_varray_dynsize): if the element type is marked
for character conversion, then do the size calculation for
char and zchar by measuring the UTF-8 coded size.
(ffi_varray_alloc): Call ffi_varray_dynsize to get the size,
to benefit from the char handling. Thus when FFI allocates
buffers for a variable length array, it will allocate correct
size required for the UTF-8 encoded string.
(ffi_varray_put, ffi_varray_in): Here we must call
ffi_varray_dynsize and divide by the element type to get the
proper numer of elements. Then we must check for character
conversion and handle the cases.
(ffi_varray_null_term_in): Check for character conversion
cases and route those through ffi_varray_in, which handles
null-terminated strings.
* tests/017/ffi-misc.tl: New file.
* tests/017/ffi-misc.expected: New file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some functions in utf8.c have w_ prefixes. They are wide
character wrappers for functions that take multi-byte string
inputs.
The prefix is being inappropriately used in the names of a
few sysif functions that should be named _wrap.
* sysif.c (w_stat, w_lstat, w_fstat): Rename to do_stat,
do_lstat and do_fstat, respectively. These are callbacks
used with stat_impl.
(statp, statl, statf): Rename to stat_wrap, lstat_wrap and
fstat_wrap, following existing convention. Additionally,
stat_wrap becomes static since nothing outside this file
calls it.
(sysif_init): Follow renames of statp, statl and statf.
* sysif.h (statp): Declaration removed.
(statf): Renamed to fstat_wrap.
* parser.c (load_rcfile): Follow statf rename.
|
|
|
|
|
|
|
| |
* sysif.c (get_fd): Make available under HAVE_SYS_STAT.
(fstat): Allow fd or stream argument using get_fd.
* txr.1: Documented.
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/with-resources.tl (with-resources):
Rearrange tree-case cases to recognize a sequence of cleanup
forms and insert into the output accordingly.
* txr.1: Documented.
|