| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (copy_file_set_entries): Add path-equal to autoload symbols.
* stdlib/copy-file.tl (path-equal): New function.
* tests/018/path-equal.tl: New file.
* txr.1: Documented.
|
|
|
|
|
|
|
| |
* stream.c (run): replace_env takes only one argument.
* tests/018/process.tl: *child-env* tests are reporting some extra
environment variables on Windows; let's just disable them.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This specifies the environment to be used for executing
programs.
* stream.c (open_subprocess, run): Check *child-env* variable and if
other than t, then install the environment before execvp.
In the spawn-based version of run, we save and restore the
environment around the spawn call, if *child-env* is in
effect.
* sysif.c (child_env_s): New symbol variable.
(exec_wrap): If *child-env* is other than t, then save the
environment in a list, and install the specified environment
before calling execvp. If that function returns, restore the
environbment.
* sysif.h (child_env_s): Declared.
(child_env): New macro.
* tests/018/process.tl: New tests.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The new function:
- just returns the name if it contains path name components.
- returns nil if the name is "." or "..".
- tests for existence only, not permission to execute.
* lisplib.c (path_test_set_entries): Do not auto-load path-test
module on the path-search symbol, since it is no longer implemented
there.
* stdlib/path-test.tl (path-search): Function removed.
* stream.c (path_var_sep_char): New global variable.
(path_search): New function.
(detect_path_separators): Also set path_var_sep_char to semicolon
on Cygnal.
(stream-init): Register path-search intrinsic here now.
* stream.h (path_var_sep_char, path_search): Declared.
* tests/018/path-test.tl: New tests.
* txr.1: Documentation revised for path-search.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Basic idea: when we throw an exception that pertains to a
system error which has an errno code, we can stick the errno
into the memory area of the character string, into the wchar_t
that immediately follows the null terminator. We can do this
because strings track their actual allocation size.
A pair of setter/getter functions to set and retrieve this
value are provided, and all functions in the code which can
set such a code are updated to do so, simply by calling the
newly added uw_ethrowf that drop-in replaces for uw_throwf.
* lib.[ch] (string_set_code, string_get_code): New functions.
* unwind.[ch] (uw_ethrowf): New function.
* eval.c (eval_init): Register string-set-code and
string-get-code intrinsics.
* ftw.c (ftw_wrap): Switch to uw_ethrowf.
* parser.c (open_txr_file): Likewise.
* socket.c (dgram_overflow): Store the ENOBUFS error in errno,
and use uw_ethrowf instead uw_throwf.
(dgram_get_byte_callback, dgram_flush, sock_bind, to_connect,
open_sockfd, sock_connect, sock_listen, sock_accept,
sock_shutdown, sock_timeout, socketpair_wrap): Switch to
uw_ethrowf.
* stream.c (dev_null_get_fd, stdio_maybe_read_error,
stdio_maybe_error, stdio_close, pipe_close, open_directory,
open_file, open_fileno, open_tail, fds_subst,
open_subprocess, open_command, remove_path, rename_path,
tmpfile_wrap, mkdtemp_wrap, mkstemp_wrap): Switch to uw_ethrowf.
* sysif.c (mkdir_wrap, ensure_dir, chdir_wrap, getcwd_wrap,
rmdir_wrap, mknod_wrap, mkfifo_wrap, chmod_wrap, do_chown,
symlink_wrap, link_wrap, readlink_wrap, close_wrap, val
exec_wrap, stat_impl, do_utimes, pipe_wrap, poll_wrap,
getgroups_wrap, setuid_wrap, seteuid_wrap, setgid_wrap,
setegid_wrap, setgroups_wrap, getresuid_wrap, setresuid_wrap,
setresgid_wrap, crypt_wrap, uname_wrap, opendir_wrap,
getrlimit_wrap, setrlimit_wrap): Likewise.
* termios.c (tcgetattr_wrap, tcsetattr_wrap, tcsendbreak_wrap,
tcdrain_wrap, tcflush_wrap, tcflow_wrap): Likewise.
* tests/018/errno.tl: New file.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For instance, this bad output is produced:
(pic "+0####.## <<<<<" 123 1) -> "+00123.00 +1 "
The second argument should not have any leading + sign.
* stream.c (formatv): For each new conversion specifier introduced by ~,
reset the sign variable to zero also. That's the semantic change here,
occluded by the fact that I'm rearranging the declaration of the
variables, adding comments, and condensing the assignments while also
getting them into the same order as the declarations, in order that this
sort of bug does not creep in in the future, should another such
variable be added.
* tests/018/format.tl: Adding correct version of above test case.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* tests/common.tl (os-symbol): Look for the substring BSD in
the system name, and map to symbol :bsd. Do not produce
the :openbsd symbol.
* tests/014/socket-basic.tl: Refer to :bsd, not :openbsd.
* tests/017/glob-carray.tl: Likewise.
* tests/018/chmod.tl: Likewise.
|
|
|
|
| |
* tests/018/path.tl: New tests.
|
|
|
|
|
| |
* tests/018/path.tl: test coverage for abs-path-p and
portable-abs-path-p.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* tests/002/query-1.txr: Skip test if an executable
/bin/sh doesn't exist, rather than the bogus reasons.
* tests/010/json.tl: Change the condition for the
command-put-json tests: not whether cat is found
in the search path but whether /bin/sh exists and is executable.
* tests/017/realpath.tl: Also quit if /usr/bin doesn't exist.
* tests/018/path-test.tl: Exit succesfully if /bin/sh
does not exist. Revert the earlier change.
* tests/018/process.tl: Quit if no executable /bin/sh exists.
|
|
|
|
|
|
|
| |
* tests/018/path-test.tl: In the Guix build environment, the
shell might be found at a path not ending in bin. Let's
ust test for ending in /bin. Reported and investigated by
Paul A. Patience.
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.c, stream.h (add_suffix): New function.
(stream_init): add-suffix intrinsic registered.
* tests/018/path.tl: Tests.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c, lib.h (chk_substrdup): New function.
* stream.c, stream.h (trim_short_suffix, trim_long_suffix):
New functions.
(stream_init): trim-short-suffix and trim-long-suffix
intrinsics registered.
* tests/018/path.tl: New tests.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
| |
* tests/018/path.tl: New cases covering dotted name situation,
which is not a suffix, but can have a suffix.
|
|
|
|
|
|
| |
* tests/018/chmod.tl (os): Fix final parentheses of defvarl form
accidentally encompassing the rest of the source file. Replace tabs with
spaces.
|
|
|
|
|
| |
* tests/018/path-test.tl: Check that the result of a path-search for
"sh" only ends in "/bin/sh", not that it is precisely "/bin/sh".
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Another requirements tweak to short-suffix and long-suffix:
ignore one or more trailing slashes, instead of just one.
This harmonizes with base-name, which does same, that
requirement being copies from the POSIX basename utility.
* stream.c (short_suffix, long_suffix): If sl points to a
trailing slash which is the start of a suffix that consists of
nothing but trailing slashes, then we pretend it isn't there.
* tests/018/path.tl: Adjusted two existing test cases, and
added more.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (path_vcat): New static function.
(stream_init): Register path-cat instrinsic to path_vcat
rather than path_cat.
* tests/018/path.tl: path-cat tests: all examples from
documentation, plus others.
* txr.1: Documented existing behaviors that were not clear,
like when inputs are empty. Documented new variadic semantics.
Examples added.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (path_test_set_entries): Autoload on path-search.
* stdlib/path-test.tl (path-search): New function.
* tests/018/path-test.tl: New file.
* txr.1: Documented.
* stdlib/doc-lookup.tl: Updated.
|
|
|
|
|
|
|
|
| |
* stream.c (base_name): We must check for a zero length
suffix, otherwise sub(base, zero, neg(length(suff)))
produces an empty string.
* tests/018/path.tl: Test cases for base-name.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The short-suffix and long-suffix functions will now return the
suffix including the leading period. This was a suggestion
from user Paul A. Patience, which is a good requirement.
Since these functions were newly introduced just the last
release, I'm not going to provide backwards compatibility
switching for them.
* stream.c (short_suffix, long_suffix): Duplicate the suffix
starting at the dot, not dot + 1.
* tests/018/path.tl: Test cases updated.
* txr.1: Documentation updated.
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (short_suffix, long_suffix): Do not treat the
starting dot of the last componet as a suffix delimiter.
* tests/018/path.tl: Test cases edited to reflect
requirements change; new tests added.
* txr.1: Updated.
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (short_suffix, long_suffix): Take path separator
characters into account; the suffix must not span across
separators. The trailing separator must also not appear in
the suffix.
* tests/018/path.tl: Test cases added.
* txr.1: Redocumented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (short_suffix, long_suffix): New functions.
(stream_init): short-suffix and long-suffix intrinsics
registered.
* stream.c (short_suffix, long_suffix): Declared.
* tests/018/path.tl: New file.
* txr.1: Documented.
* share/txr/stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (fds_subst, fds_swizzle, fds_restore): These functions are
used on Cygwin by some functions that are based on spawn, and so must be
avaiable.
* tests/018/process.tl: Two fixes here. Firstly, the 1>&1 redirection in
one of the tests should be 1>&2 on all platforms. That a temporary edit
left behind from massaging the tests and the code. Secondly, some weird
results are observed on Cygwin. The communication with the child sees
an extra carriage return and space sneak in. I'm just codifying this as
Cygwin's way of passing the test case; it's likely unfixable at the
application level.
|
|
|
|
| |
* tests/018/process.tl: New file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are a number of issues, such as left adjustment not
working and such. This needs a better treatment from the
requirements level, through to a set of test cases.
* stream.c (max, min): Macros macros added, in their usual
form.
(vformat_num): Implement new rules which suppress the zero and
space characters used in place of a sign if they overflow the
field width.
(formatv): Clamp integer precision field to width - 1 for
integers, for consistency with floating-point handling.
For floating-point values under ~a and ~s, do not force
the second stage precision to width - 1; only clamp it
if it is greater.
* format.tl: Numerous new tests.
* txr.1: Significant redocumenting of this area. The handling
of numbers is described as a two stage process, clarifying the
changing role of "precision" in the two stages.
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (formatv): The - precision option character
produces a "sign" that is a zero. If this is used with leading
zeros, it will avoid generating a space. The requirements can
use improvement here, but one step at a time.
* tests/018/format.tl: Some tests.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/pic.tl (pic): Refactor string compilation
code into local function which has access to the overall
argument list. Recognize the quasiliteral case and translate
by compiling all the string parts, then forming a recombined
quasiliteral where the compiled parts are substituted.
* tests/018/format.tl: test case for this.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/pic.tl (expand-pic-num, expand-pic, pic):
Allow ### to be followed by a single !. This is not counted
toward the field width.
* tests/018/format.tl: Cover with some tests.
* txr.1: Doc updated.
|
|
|
|
|
|
|
|
| |
* tests/018/format.tl: Add tests which combine overflow
flagging with +/-. The space generated by - contributes to
overflow.
* txr.1: Clarify overflow issue in documentation.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/pic.tl (expand-pic-num): Bug: when a field
overflows, the (rest ...) call truncates the leftmost digit.
A failing test case is (pic "#.#" 12) which produces "2.0"
instead of "12.0". Firstly, we only need that logic at all in
the zero padding case. When the number is positive, we stick
in the + request, so we are sure to get a + character. The
rest call then predictably chops off the + rather than a
digit.
(pic-join-opt): Fix two bugs here in the string-string combine
case: using s2 instead of s1, and not splicing in rest.
(expand-pic, pic): Implement tightening for escape sequences.
If ~ is not followed by anything, or not followed by the
documented characters for escaping, it is erroneous.
* format.tl: Battery of new tests.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* buf.c (buf_hex): New function.
* buf.h (buf_hex): Declared.
* stream.c (formatv): Support printing of buffers in hex
via temporary buffer containing hex characters, similarly
to how bignums are handled.
* tests/018/format.tl: New file, providing some coverage over
new and affected code.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/copy-file.tl: When removing .. components,
a dotdot must only cancel preceding non-dotdot. We must check
not only that the out stack is not empty but that the top
element isn't dotdot. Also, eliminate empty components, like
the documentation says. Lastly, we must check for the impossible
cases, when the from path uses .. components that are
impossible to navigate backwards to form a relative path.
* tests/018/rel-path.tl: Test cases added.
* txr.1: Updated with additional descriptions, fixes and
examples.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (copy_file_set_entries): Add rel-path as autoload
trigger for copy-file module.
* share/txr/stdlib/copy-file.tl (rel-path): New function.
* tests/018/rel-path.tl: New file.
* txr.1: Documented.
* share/txr/stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* tests/014/socket-basic.tl (%iters%): Also reduce to 2000 on
OpenBSD, to avoid the default limit on UDP datagram size.
* tests/017/glob-carray.tl: Use the BSD-style struct glob-t
on OpenBSD also.
* tests/017/glob-zarray.tl: Likewise.
* tests/018/chmod.tl (os): New global variable.
(test-sticky): s-isvtx not allowed for non-root user on
OpenBSD, so we falsify this variable.
* tests/common.tl (os-symbol): Add OpenBSD case, producing
:openbsd keyword symbol.
(libc): Let's just use (dlopen nil) for any platform that isn't
Cygwin or Cygnal.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Makefile (%.expected): New implicit rule. Whenever a test requires a
.expected file, if it is missing, we create an empty one.
This file will be treated as an intermediate by GNU Make, which means
that it will be deleted when make terminates.
* tests/012/compile.tl: Some of the .tl files no longer have
an .expected file, so we have to test for that in the
catenating logic.
* tests/008/call-2.expected,
* tests/008/no-stdin-hang.expected,
* tests/011/macros-3.expected,
* tests/011/patmatch.expected,
* tests/012/aseq.expected,
* tests/012/ashwin.expected,
* tests/012/compile.tl,
* tests/012/cont.expected,
* tests/012/defset.expected,
* tests/012/ifa.expected,
* tests/012/oop-seq.expected,
* tests/012/parse.expected,
* tests/012/quasi.expected,
* tests/012/quine.expected,
* tests/012/seq.expected,
* tests/012/struct.expected,
* tests/012/stslot.expected,
* tests/014/dgram-stream.expected,
* tests/014/in6addr-str.expected,
* tests/014/inaddr-str.expected,
* tests/014/socket-basic.expected,
* tests/015/awk-fconv.expected,
* tests/015/split.expected,
* tests/015/trim.expected,
* tests/016/arith.expected,
* tests/016/ud-arith.expected,
* tests/017/ffi-misc.expected,
* tests/018/chmod.expected: Empty file deleted.
|
|
|
|
|
|
|
| |
* tests/018/chmod.tl: Certain chmod test cases no longer work
on Cygwin. The issue is the chmod system call. It produces
completely nonsensical results in some cases. We disable
these test cases on Cygwin.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On Solaris, we can't set the sticky bit on a non-directory
without special privilege.
Let's detect whether we can set the sticky bit on our test
object. If we can't, then we avoid executing tests that
involve the sticky bit.
* tests/018/chmod.tl (test-sticky): New variable.
(cht): If test-sticky is false, only run the test if none of
the inputs contain a 't'.
|
|
|
|
|
|
| |
* tests/018/chmod.tl (mode-bits): Change body to correct
quasiquote.
(cht): Use previously unreferenced mode-bits macro.
|
|
|
|
|
|
|
|
|
| |
This is Coreutils chmod behavior.
* sysif.c (chmod_wrap): Sample cmode into oldm at the start of
every assigment before punching the masked hole into cmode.
* tests/018/chmod.tl: Breaking test case added.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|