Commit graph

8166 commits

Author SHA1 Message Date
Sylvestre Ledru
5a7c50d64e uucore: add functions to manage translations 2025-05-23 23:37:59 +02:00
Dorian Péron
cd9ce77098
Merge pull request #7953 from frendsick/fix/expr-regex-anchors
expr: Fix parsing regex anchors '^' and '$'
2025-05-23 15:16:28 +02:00
Teemu Pätsi
29332865a9
expr: Handle special cases for $ in regex
Enable fixed test `test_bre11`
2025-05-23 15:29:55 +03:00
Teemu Pätsi
f664578a4b
expr: Handle special cases for ^ in regex 2025-05-23 15:23:21 +03:00
Daniel Hofstetter
73e447224c Adapt to API changes in nix 2025-05-23 09:24:46 +02:00
Daniel Hofstetter
3a05fa92d6
Merge pull request #7908 from sylvestre/selinux-installa
selinux: start the support of install
2025-05-22 15:14:08 +02:00
Alexander Shirokov
14a8f3f3f9
shred:add checks for block sizes
This commit adds checks for block size constants. Misconfigured sizes
could lead to overflows or performance issues. While such cases are
expected to be rare or unlikely, it's better to be notified of them
early.
2025-05-21 15:54:12 +02:00
Alexander Shirokov
24d88d777a
shred:bitwise method to set OPTIMAL_IO_BLOCK_SIZE
The value of the variable remains unchanged (4096 = 2 ^ 12), but using a
bitwise expression provides two benefits:

- follows the same approach used for configuring BLOCK_SIZE

- indicates that a power-of-two value is preferred for this kind of
  constant
2025-05-21 14:54:58 +02:00
Tom D.
9fce1a1529
tsort: remove duplicate sorting step (#7965)
* tsort: remove duplicate sorting step

* tsort: remove unnecessary spaces

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2025-05-21 10:29:21 +02:00
Sylvestre Ledru
38861cc767 selinux: add support for install 2025-05-21 09:51:27 +02:00
Sylvestre Ledru
71af6d2089 selinux/uucore: add two functions: contexts_differ & preserve_security_context 2025-05-21 09:51:27 +02:00
Sylvestre Ledru
a7b005c5e3
Merge pull request #7942 from cakebaker/sync_move_function_call_to_unsafe_block
sync: move call to unsafe fn to unsafe block
2025-05-20 09:44:48 +02:00
Daniel Hofstetter
dde7324e3f mv: use bool instead of Result as return type
for can_delete_file function
2025-05-20 07:31:57 +02:00
Daniel Hofstetter
cdca6d6a8d sync: move call to unsafe fn to unsafe block 2025-05-19 11:18:12 +02:00
Daniel Hofstetter
ee665fbebe more: fix warning from let_and_return lint 2025-05-19 10:08:40 +02:00
Daniel Hofstetter
8674e86703 cp: fix warnings from unnecessary_debug_formatting
Co-authored-by: Jeremy Smart <jeremy3141592@gmail.com>
2025-05-19 09:54:37 +02:00
Daniel Hofstetter
7a706b5756 mv: fix warning from io_other_error lint
Co-authored-by: Jeremy Smart <jeremy3141592@gmail.com>
2025-05-19 09:27:36 +02:00
Aaron Ang
7692b93ea6 more: constant mem initialization for files and pipes 2025-05-18 21:09:48 +02:00
Daniel Hofstetter
438ed3c6c6 doc: fix warnings from markdown linter 2025-05-18 21:08:27 +02:00
Jeremy Smart
a5a9f7d44d
pr: migrate from quick-error to thiserror (#7919)
* remove quick-error from pr

* fix windows compilation, Cargo.toml
2025-05-15 09:19:46 +02:00
Sylvestre Ledru
5e11842428
Merge pull request #7932 from cakebaker/ls_remove_duplicate_code
ls: remove duplicate code
2025-05-15 09:19:16 +02:00
Nicolas Boichat
1fc14d837c wc: Align buffer to 32-byte boundary
bytecount uses vector operations to speed up line counting.
At least on x86 with AVX2 support, the vectors are 256-byte wide,
and operations are much faster if the data is aligned.

Saves about 4% of total performance, matching wc's performance.
2025-05-15 05:03:08 +02:00
Nicolas Boichat
1fe539f1d4 wc: Increase buffer size to 256kb
Improves performance by about 4% on large files.
2025-05-15 05:02:27 +02:00
Daniel Hofstetter
c3fea933e1 ls: remove duplicate code 2025-05-14 17:00:00 +02:00
Daniel Hofstetter
a6d9bfbaa0 mktemp: use keep instead of deprecated into_path 2025-05-12 07:43:26 +02:00
Alexander Shirokov
a73c0ea290 shred: improve write logic to support data alignment
This commit improves the reliability of the writing logic and removes
implicit dependencies between the preferred I/O size and the block size.

For example, in earlier versions, using BLOCK_SIZE != N * IO_SIZE could
lead to overflows due to alignment with values larger than the buffer
size.
2025-05-11 23:36:53 +02:00
Alexander Shirokov
745d2add08 shred: add 4K data alignment
This commit allows aligning output data by 4K to better match GNU shred.

The 4K block size is configured as a constant because it provides a
widely used value in the simplest way. However, there is a chance that
some systems may use a different value. So far, I haven't encountered
anything other than 4K, I decided not to overcomplicate the approach for
now.
2025-05-11 23:36:53 +02:00
Daniel Hofstetter
f4b1a97c0a id: remove unnecessary to_string calls 2025-05-11 13:35:43 +02:00
Sylvestre Ledru
545fab9544 selinux: add the desc of the module 2025-05-11 09:36:18 +02:00
Sylvestre Ledru
6091d0b62b selinux: use the uucore::selinux::is_selinux_enabled() function 2025-05-11 09:36:15 +02:00
Sylvestre Ledru
45b0c39ed7
Merge pull request #7892 from cakebaker/uptime_refactor_uumain
uptime: refactor `uumain`
2025-05-09 22:11:44 +02:00
Daniel Hofstetter
7c865b29a1
Merge pull request #7898 from sylvestre/selinux-err
selinux: get closer to the GNU error msgs
2025-05-09 13:35:29 +02:00
Jeremy Smart
a752f73476
csplit: don't add a newline if the file doesn't end with one (#7901)
* csplit: don't add a newline if the file doesn't end with one

* refactor test

* refactor
2025-05-09 09:15:54 +02:00
Sylvestre Ledru
fde3733bf5 selinux: improve the error display 2025-05-07 22:58:52 +02:00
Sylvestre Ledru
832dd495bf selinux: adjust more error messages 2025-05-07 22:58:46 +02:00
Sylvestre Ledru
2e34d94e17 selinux: upstream expects lower case 2025-05-07 22:58:39 +02:00
Daniel Hofstetter
bcc02e9cea
Merge pull request #7897 from aaron-ang/ptx-panic
ptx: use char count instead of byte index to handle utf-8 characters
2025-05-07 15:52:13 +02:00
Aaron Ang
1cfb19a936 ptx: use char count instead of byte index to handle utf-8 characters 2025-05-06 23:41:02 -07:00
Daniel Hofstetter
26e175757d uptime: extract uptime_since fn 2025-05-06 17:05:12 +02:00
Daniel Hofstetter
c6b12cfb96 uptime: remove path arg under Windows 2025-05-06 16:47:52 +02:00
Daniel Hofstetter
b78f78bedf uptime: use clap to handle too many path args 2025-05-06 16:05:23 +02:00
Daniel Hofstetter
157f653780 uptime: merge two imports 2025-05-06 10:58:55 +02:00
Daniel Hofstetter
876f941e8e uptime: add two empty lines 2025-05-06 10:56:56 +02:00
Daniel Hofstetter
f6d19fab79 uptime: use same code structure in two blocks 2025-05-06 10:55:09 +02:00
Daniel Hofstetter
52a2b664e2 uptime: don't return Result from print_nusers 2025-05-06 10:47:10 +02:00
Sylvestre Ledru
5148ba12d6 set_selinux_security_context: also display the error from the crate
+ fix comments from review
2025-05-06 08:52:27 +02:00
Sylvestre Ledru
b3a2b74ca1 cp/selinx: improve the support of --preserve-context and simplify the code.
+ Add test for the selinux changes with context SLASHLogin
Improves the coverage of tests/cp/cp-a-selinux.sh
2025-05-06 08:52:27 +02:00
SLASHLogin
74e72f527b cp: add -Z flag & add --context=[CTX] flag 2025-05-06 08:52:27 +02:00
Sylvestre Ledru
e7fdd3dfba selinux: add support in cp 2025-05-06 08:52:27 +02:00
Daniel Hofstetter
781a48b3a9 uptime: fix typo (formated -> formatted) 2025-05-05 14:47:57 +02:00