1
0
mirror of git://git.suckless.org/sbase synced 2025-03-11 07:17:56 +00:00
Commit Graph

2634 Commits

Author SHA1 Message Date
Roberto E. Vargas Caballero
bb367fd6c7 Move more things around 2024-12-19 16:20:39 +01:00
Roberto E. Vargas Caballero
8291582b6e Move more things around 2024-12-19 16:09:48 +01:00
Roberto E. Vargas Caballero
7c207664f8 Move more things around 2024-12-19 15:38:32 +01:00
Roberto E. Vargas Caballero
ca9f7351bb Move more things around 2024-12-19 13:40:49 +01:00
Roberto E. Vargas Caballero
6591fb9888 Move more things around 2024-12-19 13:35:08 +01:00
Roberto E. Vargas Caballero
91aed23a5d Move more things around 2024-12-19 13:30:32 +01:00
Roberto E. Vargas Caballero
efd99dad76 Move more things around 2024-12-17 10:56:56 +01:00
Roberto E. Vargas Caballero
23f879d1dc Move more things around 2024-03-22 04:32:56 +01:00
Roberto E. Vargas Caballero
bbd10e0d30 Move more things around 2024-03-13 13:47:59 +01:00
Roberto E. Vargas Caballero
ba7741a7bc Move things out of ubase 2024-03-13 12:07:59 +01:00
Roberto E. Vargas Caballero
5c804bdf56 Move non posix tools out of sbase 2024-03-13 11:52:40 +01:00
Roberto E. Vargas Caballero
232b10bcd8 Move sbase into a subdirectory 2024-03-12 21:44:03 +01:00
Roberto E. Vargas Caballero
6d6adbd015 Merge branch 'master' into HEAD 2024-03-12 21:12:57 +01:00
Roberto E. Vargas Caballero
a488584c21 Prepare merge with sbase 2024-03-12 21:12:09 +01:00
Roberto E. Vargas Caballero
ac6d382515 build: Fix sbase-box-install target
The target tried to execute a non valid shell script
and there was a possibility to fatorize the creation
of the proto file instead of repeating it in all
the actions that required.
2024-03-12 17:11:35 +01:00
Roberto E. Vargas Caballero
a570a80ed1 su: Fix running it without arguments
The commit 8f5a0c3 introduced a regression and the logic
to control the number of arguments was broken after it,
giving an error when su was executed without parameters.
2024-03-07 22:35:31 +01:00
Elie Le Vaillant
13898fa7a9 tar: chktar: fix conditional typo 2024-03-06 16:00:10 +01:00
neeshy
4cd0b14380 su: don't set $PATH
Just /bin is too restrictive, and login shells set the path anyway via
the default profile. Also, carrying the path over for non-login shells
conforms to the behavior of util-linux's su.
2024-03-06 10:12:49 +01:00
neeshy
e9bcdcc341 su: check $SHELL for validity
If $SHELL isn't defined in the environment, the call to execve will
fail when -p is specified. Fallback to the user's login shell if $SHELL
is invalid.
2024-03-06 10:11:29 +01:00
neeshy
cf9e26d7fa su: fix setting argv0
argv0 was being set to the user's login shell even when -p was
specified. Only populate newargv once the shell is properly determined.
2024-03-06 10:11:23 +01:00
neeshy
8f5a0c3236 su: simplify logic
Inline dologin, and simplify common code
2024-03-06 10:11:07 +01:00
Elie Le Vaillant
bca3fcca91 tar: sanitize, chktar: leading spaces should be skipped over
Some tar archives (eg. ftp://ftp.gnu.org/gnu/shtool/shtool-2.0.8.tar.gz)
use leading spaces instead of leading zeroes for numeric fields.
Although it is not allowed by the ustar specification, most tar
implementations recognize it as correct.  But since 3ef6d4e4, we
replace all spaces by NULs here, not just trailing ones, which leads to
recognizing such archives as malformed.  This fixes it: we now skip
over leading spaces, allowing strtol(3) to read those numeric fields.
2024-03-05 13:25:44 +01:00
Randy Palamar
d335c366f7 expr: tonum: handle case where result was previously calculated
As pointed out in a mail to dev expr was segfaulting when multiple
math operations were specified on the command line: eg. 'expr 3 \*
2 + 1'. This happens because the tonum(), introduced in e50d533,
assumed that v->str was always non null. parse() guarantees this
for user input but this is not the case when doop() is called with
the result of a previous calculation. However in that case we know
that v->num is already valid so we can simply return.
2024-01-31 05:00:51 +01:00
Roberto E. Vargas Caballero
6b9da17eb4 build: Fix OBJ definition and remove MAN
The MAN macro was not used, and it and OBJ had the same problem
because they were defined using an empty string in the replace
pattern of the macro expansion, but as it is said by POSIX:

	The subst1 to be replaced shall be recognized when it is a suffix
	at the end of a word in string1

so, an empty string should not be used.

Also, a new inference rule is added to generate the binary
directly from the .c without generating the intermediate
object, removing the need of chaining different inference
rules which is not guaranteed to work in all the make
implementations.
2024-01-19 22:01:25 +01:00
Randy Palamar
270ca025ce expr: don't evaluate matched substr as a number
POSIX specifies that if the pattern contains a subexpression then
the first matched subexpression should be returned if it exists.

This fixes things like the following:

./expr 00003 : '\(.*\)'
Before: 3
After: 00003
2024-01-16 09:11:46 +01:00
Randy Palamar
e50d533d59 expr: treat expressions as strs until evaluation
Comparison operations (>, <, =, etc.) and matching operations must
operate originally provided string not one that has gone back and
forth through string formatting. This caused operations such as
the following to give incorrect results:

./expr 00003 : '.*'
Before: 1
After: 5

This commit fixes that issue.
2024-01-16 09:11:40 +01:00
Roberto E. Vargas Caballero
7d5b113423 ed: Add new TODO 2024-01-12 20:48:42 +01:00
Roberto E. Vargas Caballero
2732217a40 ed: Handle correctly lines in substitutions
The s command can apply a replace pattern with embedded newlines
which modifies the line/index assignament. Using a range in  the
address fail because afther the call to subline() the next  line
has to be searched based in the index because the replace  could
insert newlines.
2023-12-29 20:27:23 +01:00
Jules Maselbas
e24228e062 sbase-box: Fix segmentation fault when exe without args
when sbase-box is executed without argument, the check sbase-box
options doesn't verify the argument count leading to a segfault.

Add a check on the argc before parsing sbase-box options (currently
only `-i`)
2023-12-28 20:16:54 +01:00
Roberto E. Vargas Caballero
6a557314b9 ed: Don't undo commands in sigint
If newcmd is 0 then error() undo all the modifications
that happened since the last command, but this is  not
what POSIX mandates:

SIGINT	The ed utility shall interrupt its current activity, write the
	string "?\n" to standard output, and return to command mode
	(see the EXTENDED DESCRIPTION section).
2023-12-28 17:26:50 +01:00
Roberto E. Vargas Caballero
bbdd7bedc4 ed: Simplify sighup dealing
As we already have the dump() function we can move the
modification check inside the new dump() function.
2023-12-28 17:19:47 +01:00
Roberto E. Vargas Caballero
137f0917e4 ed: Print only last line in empty command 2023-12-28 17:19:17 +01:00
Roberto E. Vargas Caballero
2d4d7dc6d4 ed: Fix G and V commands 2023-12-28 17:16:34 +01:00
Roberto E. Vargas Caballero
516e7fec92 ed: Remove nothing comments
Several bugs happened in the past due to this kind of comments
and it is better to get rid of them.
2023-12-28 17:16:24 +01:00
Roberto E. Vargas Caballero
54a0fc3ecc ed: Fix makeline
Strings without newlines created problems in the function
and the global field was not updated, making that new lines
added were marked as global being processed in the current
global command.
2023-12-28 17:14:04 +01:00
Roberto E. Vargas Caballero
09dc00f995 ed: Update TODO
Remove the cases are tested to work correctly now.
2023-12-28 17:04:13 +01:00
Roberto E. Vargas Caballero
890f6c2c05 ed: Improve execsh 2023-12-28 17:02:44 +01:00
Roberto E. Vargas Caballero
aacfa18b79 ed: Avoid dangling pointer in getrhs()
If the string r.str is freed but error() is called then
next call will see a pointer that maybe it will try to free
because the call to error unwind the frame stack.
2023-12-28 17:02:19 +01:00
Roberto E. Vargas Caballero
b089261c3a ed: Read from input in append()
This enables using a and i commands in a global command
because the input is not anymore taken from stdin.
2023-12-28 17:01:58 +01:00
Roberto E. Vargas Caballero
1e10bf6069 ed: Add getinput() and setinput()
These functions allow to read from stdin the full next
line or seting as input a character array. These functions
avoid all the complexity about repeat commands that is very
fragile and depends on having multiple global variables with
weak relation between them.
2023-12-28 16:49:34 +01:00
Roberto E. Vargas Caballero
b710ee81fc ed: Add copystring()
This makes possible to use the function to initialize the string from
an existing char array.
2023-12-28 14:01:30 +01:00
Quentin Rameau
4cf7643094 find: Make parameter error messages more specific
Differenciate option operands from path operands
when an error is detected on the command line parameters.
2023-11-14 19:36:18 +01:00
Quentin Rameau
870b26af8e scripts: Fix non-portable find -perm /mode 2023-11-14 19:35:23 +01:00
Quentin Rameau
f496998f4f scripts: Fix non-portable usage of find -maxdepth 2023-11-14 19:35:03 +01:00
Quentin Rameau
6fc6bbbf71 scripts: Force file copying on install
This would otherwise cause an issue using cp to copy cp to itself.
2023-11-14 19:34:27 +01:00
Quentin Rameau
c31af02d22 make: fix rogue parameter in install target 2023-11-14 19:34:08 +01:00
Hiltjo Posthuma
0a82a7d91a TODO: add replacement bug reported for ed
Also reported on IRC:

"escaping the delimiter in replacement fails also: s/./\//"
2023-10-29 17:48:13 +01:00
Roberto E. Vargas Caballero
090490b81d build: Posixfy the Makefile 2023-09-27 09:46:39 +02:00
Roberto E. Vargas Caballero
ddde8021b3 Simplify install/uninstall 2023-09-27 07:59:27 +02:00
Roberto E. Vargas Caballero
6285c22a07 build: Remove unneeded dependency
Make will search in the catalogue of rules for a way to
update the target, and in case of finding the dependency
it will apply the rule without a need of specifying that
dependency.
2023-09-27 07:59:27 +02:00