Skip to content

Add specific openbsd feature to disable use of utmpx #5613

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from

Conversation

lcheylus
Copy link
Contributor

@lcheylus lcheylus commented Dec 3, 2023

  • build.rs: add openbsd in krate list
  • Cargo.toml: add feature openbsd => no utmpx support
  • Fixes No support of utmpx on OpenBSD #5596
  • README: add cargo build with openbsd feature
  • nohup: fix for OpenBSD with _vprocmgr_detach_from_console function
  • id: fix support for OpenBSD
  • chroot: add OpenBSD support for set_groups function

  • Build OK on OpenBSD-current/amd64 with Rust v1.74.0
$ cargo build -v --release --features openbsd
(...)
    Finished release [optimized] target(s) in 5m 24s
$ target/release/coreutils
coreutils 0.0.23 (multi-call binary)

Usage: coreutils [function [arguments...]]

Currently defined functions:

    [, arch, b2sum, b3sum, base32, base64, basename, basenc, cat, chgrp, chmod, chown, chroot,
    cksum, comm, cp, csplit, cut, date, dd, df, dir, dircolors, dirname, du, echo, env, expand,
    expr, factor, false, fmt, fold, groups, hashsum, head, hostid, hostname, id, install,
    join, kill, link, ln, logname, ls, md5sum, mkdir, mkfifo, mknod, mktemp, more, mv, nice,
    nl, nohup, nproc, numfmt, od, paste, pathchk, pr, printenv, printf, ptx, pwd, readlink,
    realpath, rm, rmdir, seq, sha1sum, sha224sum, sha256sum, sha3-224sum, sha3-256sum, sha3-
    384sum, sha3-512sum, sha384sum, sha3sum, sha512sum, shake128sum, shake256sum, shred, shuf,
    sleep, sort, split, stat, stdbuf, stty, sum, sync, tac, tail, tee, test, timeout, touch, tr,
    true, truncate, tsort, tty, uname, unexpand, uniq, unlink, vdir, wc, whoami, yes

$ target/release/coreutils id
uid=1000(fox) gid=1000(fox) groups=1000(fox),0(wheel),9(wsrc),21(wobj)

$ target/release/coreutils uname -a
OpenBSD openbsd-dev.home.lan 7.4 GENERIC.MP#1471 amd64 OpenBSD
  • Tests results for openbsd feature
$ cargo test --features openbsd
(...)
failures:
    test_cat::test_error_loop
    test_chown::test_chown_no_change_to_group
    test_chown::test_chown_no_change_to_user_group
    test_chown::test_chown_only_group
    test_chown::test_chown_only_group_id
    test_chown::test_chown_owner_group
    test_chown::test_chown_owner_group_id
    test_chown::test_chown_owner_group_mix
    test_chown::test_chown_various_input
    test_cp::test_copy_contents_fifo
    test_cp::test_cp_parents_2_dirs
    test_cp::test_cp_preserve_xattr
    test_cp::test_no_preserve_mode
    test_cp::test_preserve_hardlink_attributes_in_directory
    test_cp::test_preserve_mode
    test_du::test_du_basics_subdir
    test_du::test_du_d_flag
    test_du::test_du_dereference
    test_du::test_du_hard_link
    test_du::test_du_no_dereference
    test_du::test_du_no_permission
    test_du::test_du_one_file_system
    test_du::test_du_soft_link
    test_du::test_du_symlink_multiple_fail
    test_du::test_du_threshold
    test_hostname::test_hostname_ip
    test_install::test_install_compare_option
    test_install::test_install_copy_then_compare_file
    test_ls::test_ls_allocation_size
    test_ls::test_ls_human_si
    test_ls::test_ls_long_total_size
    test_split::test_dev_zero
    test_split::test_filter_broken_pipe
    test_split::test_number_by_bytes_dev_zero
    test_stat::test_format_created_time
    test_stat::test_multi_files
    test_stat::test_normal_format
    test_stat::test_pipe_fifo
    test_stat::test_stdin_pipe_fifo1
    test_stat::test_stdin_pipe_fifo2
    test_stat::test_stdin_redirect
    test_stat::test_symlinks
    test_stdbuf::test_stdbuf_line_buffered_stdout
    test_stdbuf::test_stdbuf_trailing_var_arg
    test_stdbuf::test_stdbuf_unbuffered_stdout
    test_tail::test_follow_descriptor_vs_rename1
    test_tail::test_follow_descriptor_vs_rename2
    test_tail::test_follow_name_move1
    test_tail::test_follow_name_move2
    test_tail::test_follow_name_move_create1
    test_tail::test_follow_name_move_create2
    test_tail::test_follow_name_move_retry1
    test_tail::test_follow_name_move_retry2
    test_tail::test_follow_name_retry_headers
    test_tail::test_follow_when_files_are_pointing_to_same_relative_file_and_file_stays_same_size
    test_tail::test_retry3
    test_tail::test_retry4
    test_tail::test_retry5
    test_tail::test_retry7
    test_tail::test_retry8
    test_tail::test_stdin_redirect_dir
    test_test::test_file_is_sticky
    test_test::test_file_owned_by_egid
    test_touch::test_touch_changes_time_of_file_in_stdout
    test_touch::test_touch_dash

test result: FAILED. 2707 passed; 65 failed; 32 ignored; 0 measured; 0 filtered out; finished in 229.37s

Signed-off-by: Laurent Cheylus <foxy@free.fr>
  - add target_os cfg for pline function
  - add target_os cfg for auditd function (void on OpenBSD)

Signed-off-by: Laurent Cheylus <foxy@free.fr>
Signed-off-by: Laurent Cheylus <foxy@free.fr>
  - build.rs: add openbsd in krate list
  - Cargo.toml: add feature openbsd => no utmpx support

  - Fixes uutils#5596

Signed-off-by: Laurent Cheylus <foxy@free.fr>
Signed-off-by: Laurent Cheylus <foxy@free.fr>
@@ -110,6 +110,8 @@ cargo build --release --features macos
cargo build --release --features windows
# or ...
cargo build --release --features unix
# or ...
cargo build --release --features openbsd
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry but why do you want a new category ?
openbsd should be in unix

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, openbsd cannot be in "unix" because it includes feat_require_unix_utmpx, unsupported on OpenBSD.

@@ -25,6 +25,7 @@ build = "build.rs"
default = ["feat_common_core"]
## OS feature shortcodes
macos = ["feat_os_macos"]
openbsd = ["feat_os_openbsd"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry but i am not a fan of creating an exception for openbsd
I guess it is for utmpx?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To disable support of utmpx (not supported on OpenBSD), I created a new specific feature "openbsd" not including feat_require_unix_utmpx, see #5596 for detailed explanations. @tertsdiepraam agreed my proposal.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still, i don't think we want exceptions for every distro or unix :(

what about creating a "fake" utmpx for openbsd ? and the command would return "unsupported"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I could try another solution:

  1. close this PR and remove my work to add a specific feature "openbsd" => include openbsd in "unix" as others Unixes OS
  2. create a fake utmpx support => unsupported for tools where it's required : pinky, uptime, users and who
  3. in a second time, implement an "alternative utmpx" support for OpenBSD for pinky, uptime, users and who binaries.

Do you agree ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good, thanks :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proposal submited in PR#5620

@lcheylus
Copy link
Contributor Author

lcheylus commented Dec 5, 2023

PR canceled after discussion with @sylvestre
PR#5620 replaces it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No support of utmpx on OpenBSD
2 participants