mirror of
https://github.com/systemd/systemd
synced 2026-03-15 09:34:47 +01:00
Compare commits
17 Commits
cab4b9defd
...
4afd7808fe
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4afd7808fe | ||
|
|
701cf5b698 | ||
|
|
5169b07226 | ||
|
|
49beafb40a | ||
|
|
586ae3f29a | ||
|
|
c69c5dd58a | ||
|
|
5a30581d67 | ||
|
|
bf6452b62e | ||
|
|
0340f60ed2 | ||
|
|
c49c8331b9 | ||
|
|
f452c324e7 | ||
|
|
43e08aea6e | ||
|
|
149a8e6306 | ||
|
|
28fb7e869c | ||
|
|
480003c560 | ||
|
|
cc7fe807c1 | ||
|
|
97be547c6f |
6
.github/dependabot.yml
vendored
6
.github/dependabot.yml
vendored
@ -6,6 +6,12 @@ updates:
|
|||||||
directory: "/"
|
directory: "/"
|
||||||
schedule:
|
schedule:
|
||||||
interval: "monthly"
|
interval: "monthly"
|
||||||
|
groups:
|
||||||
|
actions:
|
||||||
|
patterns:
|
||||||
|
- "*"
|
||||||
|
exclude-patterns:
|
||||||
|
- "systemd/mkosi"
|
||||||
open-pull-requests-limit: 2
|
open-pull-requests-limit: 2
|
||||||
- package-ecosystem: "pip"
|
- package-ecosystem: "pip"
|
||||||
directory: "/.github/workflows"
|
directory: "/.github/workflows"
|
||||||
|
|||||||
4
.github/workflows/build-test.yml
vendored
4
.github/workflows/build-test.yml
vendored
@ -51,9 +51,9 @@ jobs:
|
|||||||
env: ${{ matrix.env }}
|
env: ${{ matrix.env }}
|
||||||
steps:
|
steps:
|
||||||
- name: Repository checkout
|
- name: Repository checkout
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
||||||
- name: Setup python
|
- name: Setup python
|
||||||
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
|
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
- name: Build check
|
- name: Build check
|
||||||
|
|||||||
4
.github/workflows/cifuzz.yml
vendored
4
.github/workflows/cifuzz.yml
vendored
@ -60,14 +60,14 @@ jobs:
|
|||||||
sanitizer: ${{ matrix.sanitizer }}
|
sanitizer: ${{ matrix.sanitizer }}
|
||||||
output-sarif: true
|
output-sarif: true
|
||||||
- name: Upload Crash
|
- name: Upload Crash
|
||||||
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3
|
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
|
||||||
if: failure() && steps.build.outcome == 'success'
|
if: failure() && steps.build.outcome == 'success'
|
||||||
with:
|
with:
|
||||||
name: ${{ matrix.sanitizer }}-${{ matrix.architecture }}-artifacts
|
name: ${{ matrix.sanitizer }}-${{ matrix.architecture }}-artifacts
|
||||||
path: ./out/artifacts
|
path: ./out/artifacts
|
||||||
- name: Upload Sarif
|
- name: Upload Sarif
|
||||||
if: always() && steps.build.outcome == 'success'
|
if: always() && steps.build.outcome == 'success'
|
||||||
uses: github/codeql-action/upload-sarif@51f77329afa6477de8c49fc9c7046c15b9a4e79d
|
uses: github/codeql-action/upload-sarif@b20883b0cd1f46c72ae0ba6d1090936928f9fa30
|
||||||
with:
|
with:
|
||||||
# Path to SARIF file relative to the root of the repository
|
# Path to SARIF file relative to the root of the repository
|
||||||
sarif_file: cifuzz-sarif/results.sarif
|
sarif_file: cifuzz-sarif/results.sarif
|
||||||
|
|||||||
8
.github/workflows/codeql.yml
vendored
8
.github/workflows/codeql.yml
vendored
@ -42,10 +42,10 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
||||||
|
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@51f77329afa6477de8c49fc9c7046c15b9a4e79d
|
uses: github/codeql-action/init@b20883b0cd1f46c72ae0ba6d1090936928f9fa30
|
||||||
with:
|
with:
|
||||||
languages: ${{ matrix.language }}
|
languages: ${{ matrix.language }}
|
||||||
config-file: ./.github/codeql-config.yml
|
config-file: ./.github/codeql-config.yml
|
||||||
@ -60,7 +60,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Autobuild
|
- name: Autobuild
|
||||||
uses: github/codeql-action/autobuild@51f77329afa6477de8c49fc9c7046c15b9a4e79d
|
uses: github/codeql-action/autobuild@b20883b0cd1f46c72ae0ba6d1090936928f9fa30
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@51f77329afa6477de8c49fc9c7046c15b9a4e79d
|
uses: github/codeql-action/analyze@b20883b0cd1f46c72ae0ba6d1090936928f9fa30
|
||||||
|
|||||||
4
.github/workflows/coverage.yml
vendored
4
.github/workflows/coverage.yml
vendored
@ -24,7 +24,7 @@ jobs:
|
|||||||
if: github.repository == 'systemd/systemd' || github.repository == 'systemd/systemd-stable'
|
if: github.repository == 'systemd/systemd' || github.repository == 'systemd/systemd-stable'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
||||||
- uses: systemd/mkosi@e3642f81d3a7f8f9310c0c734b2ba9dd41e50e14
|
- uses: systemd/mkosi@e3642f81d3a7f8f9310c0c734b2ba9dd41e50e14
|
||||||
|
|
||||||
# Freeing up disk space with rm -rf can take multiple minutes. Since we don't need the extra free space
|
# Freeing up disk space with rm -rf can take multiple minutes. Since we don't need the extra free space
|
||||||
@ -128,7 +128,7 @@ jobs:
|
|||||||
--quiet
|
--quiet
|
||||||
|
|
||||||
- name: Archive failed test journals
|
- name: Archive failed test journals
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v6
|
||||||
if: failure() && (github.repository == 'systemd/systemd' || github.repository == 'systemd/systemd-stable')
|
if: failure() && (github.repository == 'systemd/systemd' || github.repository == 'systemd/systemd-stable')
|
||||||
with:
|
with:
|
||||||
name: ci-coverage-${{ github.run_id }}-${{ github.run_attempt }}-arch-rolling-failed-test-journals
|
name: ci-coverage-${{ github.run_id }}-${{ github.run_attempt }}-arch-rolling-failed-test-journals
|
||||||
|
|||||||
2
.github/workflows/coverity.yml
vendored
2
.github/workflows/coverity.yml
vendored
@ -22,7 +22,7 @@ jobs:
|
|||||||
COVERITY_SCAN_NOTIFICATION_EMAIL: "${{ secrets.COVERITY_SCAN_NOTIFICATION_EMAIL }}"
|
COVERITY_SCAN_NOTIFICATION_EMAIL: "${{ secrets.COVERITY_SCAN_NOTIFICATION_EMAIL }}"
|
||||||
steps:
|
steps:
|
||||||
- name: Repository checkout
|
- name: Repository checkout
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
||||||
# Reuse the setup phase of the unit test script to avoid code duplication
|
# Reuse the setup phase of the unit test script to avoid code duplication
|
||||||
- name: Install build dependencies
|
- name: Install build dependencies
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
2
.github/workflows/development-freeze.yml
vendored
2
.github/workflows/development-freeze.yml
vendored
@ -30,7 +30,7 @@ jobs:
|
|||||||
name: Pull Request Metadata
|
name: Pull Request Metadata
|
||||||
|
|
||||||
- name: Repository checkout
|
- name: Repository checkout
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
|
|||||||
@ -23,12 +23,12 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Repository checkout
|
- name: Repository checkout
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Differential ShellCheck
|
- name: Differential ShellCheck
|
||||||
uses: redhat-plumbers-in-action/differential-shellcheck@dd551ce780d8af741f8cd8bab6982667b906b457
|
uses: redhat-plumbers-in-action/differential-shellcheck@d965e66ec0b3b2f821f75c8eff9b12442d9a7d1e
|
||||||
with:
|
with:
|
||||||
# exclude all `.in` files because they may contain unsupported syntax, and they have to be preprocessed first
|
# exclude all `.in` files because they may contain unsupported syntax, and they have to be preprocessed first
|
||||||
# TEMPORARY: exclude bash completion files, they would generate too many defects in Code scanning dashboard (600+)
|
# TEMPORARY: exclude bash completion files, they would generate too many defects in Code scanning dashboard (600+)
|
||||||
|
|||||||
6
.github/workflows/gather-pr-metadata.yml
vendored
6
.github/workflows/gather-pr-metadata.yml
vendored
@ -16,14 +16,14 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Repository checkout
|
- name: Repository checkout
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
||||||
|
|
||||||
- id: metadata
|
- id: metadata
|
||||||
name: Gather Pull Request Metadata
|
name: Gather Pull Request Metadata
|
||||||
uses: redhat-plumbers-in-action/gather-pull-request-metadata@b3dbc3f843e8343dbcb2af5bffba72c974d3a07a
|
uses: redhat-plumbers-in-action/gather-pull-request-metadata@b86d1eaf7038cf88a56b26ba3e504f10e07b0ce5
|
||||||
|
|
||||||
- name: Upload Pull Request Metadata artifact
|
- name: Upload Pull Request Metadata artifact
|
||||||
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3
|
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
|
||||||
with:
|
with:
|
||||||
name: Pull Request Metadata
|
name: Pull Request Metadata
|
||||||
path: ${{ steps.metadata.outputs.metadata-file }}
|
path: ${{ steps.metadata.outputs.metadata-file }}
|
||||||
|
|||||||
4
.github/workflows/issue-labeler.yml
vendored
4
.github/workflows/issue-labeler.yml
vendored
@ -20,7 +20,7 @@ jobs:
|
|||||||
template: [ bug_report.yml, feature_request.yml ]
|
template: [ bug_report.yml, feature_request.yml ]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
||||||
|
|
||||||
- name: Parse issue form
|
- name: Parse issue form
|
||||||
uses: stefanbuck/github-issue-parser@1e5bdee70d4b3e066a33aa0669ab782943825f94
|
uses: stefanbuck/github-issue-parser@1e5bdee70d4b3e066a33aa0669ab782943825f94
|
||||||
@ -29,7 +29,7 @@ jobs:
|
|||||||
template-path: .github/ISSUE_TEMPLATE/${{ matrix.template }}
|
template-path: .github/ISSUE_TEMPLATE/${{ matrix.template }}
|
||||||
|
|
||||||
- name: Set labels based on component field
|
- name: Set labels based on component field
|
||||||
uses: redhat-plumbers-in-action/advanced-issue-labeler@e38e6809c5420d038eed380d49ee9a6ca7c92dbf
|
uses: redhat-plumbers-in-action/advanced-issue-labeler@b80ae64e3e156e9c111b075bfa04b295d54e8e2e
|
||||||
with:
|
with:
|
||||||
issue-form: ${{ steps.issue-parser.outputs.jsonString }}
|
issue-form: ${{ steps.issue-parser.outputs.jsonString }}
|
||||||
template: ${{ matrix.template }}
|
template: ${{ matrix.template }}
|
||||||
|
|||||||
8
.github/workflows/labeler.yml
vendored
8
.github/workflows/labeler.yml
vendored
@ -30,7 +30,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Repository checkout
|
- name: Repository checkout
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
||||||
if: github.event_name == 'pull_request'
|
if: github.event_name == 'pull_request'
|
||||||
|
|
||||||
- name: Label PR based on policy in labeler.yml
|
- name: Label PR based on policy in labeler.yml
|
||||||
@ -42,7 +42,7 @@ jobs:
|
|||||||
sync-labels: false
|
sync-labels: false
|
||||||
|
|
||||||
- name: Set or remove labels based on systemd development workflow
|
- name: Set or remove labels based on systemd development workflow
|
||||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
|
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd
|
||||||
if: startsWith(github.event_name, 'pull_request') && github.event.action != 'closed' && !github.event.pull_request.draft
|
if: startsWith(github.event_name, 'pull_request') && github.event.action != 'closed' && !github.event.pull_request.draft
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
@ -83,7 +83,7 @@ jobs:
|
|||||||
}
|
}
|
||||||
|
|
||||||
- name: Add please-review label on command in issue comment
|
- name: Add please-review label on command in issue comment
|
||||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
|
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd
|
||||||
if: github.event_name == 'issue_comment' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/please-review')
|
if: github.event_name == 'issue_comment' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/please-review')
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
@ -95,7 +95,7 @@ jobs:
|
|||||||
})
|
})
|
||||||
|
|
||||||
- name: Remove specific labels when PR is closed or merged
|
- name: Remove specific labels when PR is closed or merged
|
||||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
|
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd
|
||||||
if: startsWith(github.event_name, 'pull_request') && github.event.action == 'closed'
|
if: startsWith(github.event_name, 'pull_request') && github.event.action == 'closed'
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
|
|||||||
4
.github/workflows/linter.yml
vendored
4
.github/workflows/linter.yml
vendored
@ -23,13 +23,13 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Repo checkout
|
- name: Repo checkout
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
||||||
with:
|
with:
|
||||||
# We need a full repo clone
|
# We need a full repo clone
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Lint Code Base
|
- name: Lint Code Base
|
||||||
uses: super-linter/super-linter/slim@502f4fe48a81a392756e173e39a861f8c8efe056
|
uses: super-linter/super-linter/slim@d5b0a2ab116623730dd094f15ddc1b6b25bf7b99
|
||||||
env:
|
env:
|
||||||
DEFAULT_BRANCH: main
|
DEFAULT_BRANCH: main
|
||||||
MULTI_STATUS: false
|
MULTI_STATUS: false
|
||||||
|
|||||||
4
.github/workflows/mkosi.yml
vendored
4
.github/workflows/mkosi.yml
vendored
@ -166,7 +166,7 @@ jobs:
|
|||||||
shim: 0
|
shim: 0
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
||||||
- uses: systemd/mkosi@e3642f81d3a7f8f9310c0c734b2ba9dd41e50e14
|
- uses: systemd/mkosi@e3642f81d3a7f8f9310c0c734b2ba9dd41e50e14
|
||||||
|
|
||||||
# Freeing up disk space with rm -rf can take multiple minutes. Since we don't need the extra free space
|
# Freeing up disk space with rm -rf can take multiple minutes. Since we don't need the extra free space
|
||||||
@ -311,7 +311,7 @@ jobs:
|
|||||||
"${MAX_LINES[@]}"
|
"${MAX_LINES[@]}"
|
||||||
|
|
||||||
- name: Archive failed test journals
|
- name: Archive failed test journals
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v6
|
||||||
if: failure() && (github.repository == 'systemd/systemd' || github.repository == 'systemd/systemd-stable')
|
if: failure() && (github.repository == 'systemd/systemd' || github.repository == 'systemd/systemd-stable')
|
||||||
with:
|
with:
|
||||||
name: ci-mkosi-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.distro }}-${{ matrix.release }}-${{ matrix.runner }}-failed-test-journals
|
name: ci-mkosi-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.distro }}-${{ matrix.release }}-${{ matrix.runner }}-failed-test-journals
|
||||||
|
|||||||
6
.github/workflows/requirements.txt
vendored
6
.github/workflows/requirements.txt
vendored
@ -1,6 +1,6 @@
|
|||||||
meson==1.10.0 \
|
meson==1.10.1 \
|
||||||
--hash=sha256:4b27aafce281e652dcb437b28007457411245d975c48b5db3a797d3e93ae1585 \
|
--hash=sha256:c42296f12db316a4515b9375a5df330f2e751ccdd4f608430d41d7d6210e4317 \
|
||||||
--hash=sha256:8071860c1f46a75ea34801490fd1c445c9d75147a65508cd3a10366a7006cc1c
|
--hash=sha256:fe43d1cc2e6de146fbea78f3a062194bcc0e779efc8a0f0d7c35544dfb86731f
|
||||||
ninja==1.11.1.4 \
|
ninja==1.11.1.4 \
|
||||||
--hash=sha256:055f386fb550c2c9d6157e45e20a84d29c47968876b9c5794ae2aec46f952306 \
|
--hash=sha256:055f386fb550c2c9d6157e45e20a84d29c47968876b9c5794ae2aec46f952306 \
|
||||||
--hash=sha256:096487995473320de7f65d622c3f1d16c3ad174797602218ca8c967f51ec38a0 \
|
--hash=sha256:096487995473320de7f65d622c3f1d16c3ad174797602218ca8c967f51ec38a0 \
|
||||||
|
|||||||
2
.github/workflows/scorecards.yml
vendored
2
.github/workflows/scorecards.yml
vendored
@ -29,7 +29,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
|
|||||||
2
.github/workflows/unit-tests-musl.yml
vendored
2
.github/workflows/unit-tests-musl.yml
vendored
@ -20,7 +20,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Repository checkout
|
- name: Repository checkout
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
||||||
|
|
||||||
- name: Install build dependencies
|
- name: Install build dependencies
|
||||||
uses: jirutka/setup-alpine@v1
|
uses: jirutka/setup-alpine@v1
|
||||||
|
|||||||
2
.github/workflows/unit-tests.yml
vendored
2
.github/workflows/unit-tests.yml
vendored
@ -40,7 +40,7 @@ jobs:
|
|||||||
runner: ubuntu-24.04-s390x
|
runner: ubuntu-24.04-s390x
|
||||||
steps:
|
steps:
|
||||||
- name: Repository checkout
|
- name: Repository checkout
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
||||||
- name: Install build dependencies
|
- name: Install build dependencies
|
||||||
run: |
|
run: |
|
||||||
# Drop XDG_* stuff from /etc/environment, so we don't get the user
|
# Drop XDG_* stuff from /etc/environment, so we don't get the user
|
||||||
|
|||||||
2
README
2
README
@ -201,7 +201,7 @@ REQUIREMENTS:
|
|||||||
CONFIG_PSI
|
CONFIG_PSI
|
||||||
CONFIG_MEMCG
|
CONFIG_MEMCG
|
||||||
|
|
||||||
glibc >= 2.31
|
glibc >= 2.34
|
||||||
libxcrypt >= 4.4.0 (optional)
|
libxcrypt >= 4.4.0 (optional)
|
||||||
libmount >= 2.30 (from util-linux)
|
libmount >= 2.30 (from util-linux)
|
||||||
(util-linux *must* be built without --enable-libmount-support-mtab)
|
(util-linux *must* be built without --enable-libmount-support-mtab)
|
||||||
|
|||||||
@ -225,15 +225,16 @@
|
|||||||
<term><varname>$SYSTEMD_COLORS</varname></term>
|
<term><varname>$SYSTEMD_COLORS</varname></term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Takes a boolean argument, or a special value.</para>
|
<para>Takes a boolean argument, or a special value. By default (unset), <command>systemd</command>
|
||||||
|
and related utilities will use colors in their output if possible. If <varname>$COLORTERM</varname>
|
||||||
|
is set to <literal>truecolor</literal> or <literal>24bit</literal>, 24-bit colors will be enabled,
|
||||||
|
256 colors otherwise, unless <varname>$NO_COLOR</varname> or <varname>$TERM</varname> indicates
|
||||||
|
colors are disabled.</para>
|
||||||
|
|
||||||
<variablelist>
|
<variablelist>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><option>true</option></term>
|
<term><option>true</option></term>
|
||||||
<listitem><para>The default. <command>systemd</command> and related utilities will use colors in
|
<listitem><para>Same as unset, except that <varname>$NO_COLOR</varname> is ignored.</para></listitem>
|
||||||
their output if possible. Same as <literal>auto-24bit</literal> if <varname>$COLORTERM</varname>
|
|
||||||
is set to <literal>truecolor</literal> or <literal>24bit</literal>; same as
|
|
||||||
<literal>auto-256</literal> otherwise.</para></listitem>
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
|
|||||||
@ -565,10 +565,6 @@ foreach ident : [
|
|||||||
['renameat2', '''#include <stdio.h>'''], # since musl-1.2.6
|
['renameat2', '''#include <stdio.h>'''], # since musl-1.2.6
|
||||||
['set_mempolicy', '''#include <sys/syscall.h>'''], # declared at numaif.h provided by libnuma, which we do not use
|
['set_mempolicy', '''#include <sys/syscall.h>'''], # declared at numaif.h provided by libnuma, which we do not use
|
||||||
['get_mempolicy', '''#include <sys/syscall.h>'''], # declared at numaif.h provided by libnuma, which we do not use
|
['get_mempolicy', '''#include <sys/syscall.h>'''], # declared at numaif.h provided by libnuma, which we do not use
|
||||||
['strerrorname_np', '''#include <string.h>'''], # since glibc-2.32
|
|
||||||
['mallinfo2', '''#include <malloc.h>'''], # since glibc-2.33
|
|
||||||
['execveat', '''#include <unistd.h>'''], # since glibc-2.34
|
|
||||||
['close_range', '''#include <unistd.h>'''], # since glibc-2.34
|
|
||||||
['epoll_pwait2', '''#include <sys/epoll.h>'''], # since glibc-2.35
|
['epoll_pwait2', '''#include <sys/epoll.h>'''], # since glibc-2.35
|
||||||
['fsconfig', '''#include <sys/mount.h>'''], # since glibc-2.36
|
['fsconfig', '''#include <sys/mount.h>'''], # since glibc-2.36
|
||||||
['fsmount', '''#include <sys/mount.h>'''], # since glibc-2.36
|
['fsmount', '''#include <sys/mount.h>'''], # since glibc-2.36
|
||||||
|
|||||||
@ -55,11 +55,11 @@ static ColorMode get_color_mode_impl(void) {
|
|||||||
|
|
||||||
/* First, we check $SYSTEMD_COLORS, which is the explicit way to change the mode. */
|
/* First, we check $SYSTEMD_COLORS, which is the explicit way to change the mode. */
|
||||||
ColorMode m = parse_systemd_colors();
|
ColorMode m = parse_systemd_colors();
|
||||||
if (IN_SET(m, COLOR_OFF, COLOR_16, COLOR_256, COLOR_24BIT))
|
if (m >= 0 && m < _COLOR_MODE_FIXED_MAX)
|
||||||
return m;
|
return m;
|
||||||
|
|
||||||
/* Next, check for the presence of $NO_COLOR; value is ignored. */
|
/* Next, check for the presence of $NO_COLOR; value is ignored. */
|
||||||
if (getenv("NO_COLOR"))
|
if (m != COLOR_TRUE && getenv("NO_COLOR"))
|
||||||
return COLOR_OFF;
|
return COLOR_OFF;
|
||||||
|
|
||||||
/* If the above didn't work, we turn colors off unless we are on a TTY. And if we are on a TTY we
|
/* If the above didn't work, we turn colors off unless we are on a TTY. And if we are on a TTY we
|
||||||
@ -92,13 +92,14 @@ static ColorMode get_color_mode_impl(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ColorMode get_color_mode(void) {
|
ColorMode get_color_mode(void) {
|
||||||
if (cached_color_mode < 0)
|
if (cached_color_mode < 0) {
|
||||||
cached_color_mode = get_color_mode_impl();
|
cached_color_mode = get_color_mode_impl();
|
||||||
|
assert(cached_color_mode >= 0 && cached_color_mode < _COLOR_MODE_FIXED_MAX);
|
||||||
|
}
|
||||||
|
|
||||||
return cached_color_mode;
|
return cached_color_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static const char* const color_mode_table[_COLOR_MODE_MAX] = {
|
static const char* const color_mode_table[_COLOR_MODE_MAX] = {
|
||||||
[COLOR_OFF] = "off",
|
[COLOR_OFF] = "off",
|
||||||
[COLOR_16] = "16",
|
[COLOR_16] = "16",
|
||||||
@ -107,9 +108,10 @@ static const char* const color_mode_table[_COLOR_MODE_MAX] = {
|
|||||||
[COLOR_AUTO_16] = "auto-16",
|
[COLOR_AUTO_16] = "auto-16",
|
||||||
[COLOR_AUTO_256] = "auto-256",
|
[COLOR_AUTO_256] = "auto-256",
|
||||||
[COLOR_AUTO_24BIT] = "auto-24bit",
|
[COLOR_AUTO_24BIT] = "auto-24bit",
|
||||||
|
[COLOR_TRUE] = "true",
|
||||||
};
|
};
|
||||||
|
|
||||||
DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(color_mode, ColorMode, COLOR_24BIT);
|
DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(color_mode, ColorMode, COLOR_TRUE);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check that the string is formatted like an ANSI color code, i.e. that it consists of one or more
|
* Check that the string is formatted like an ANSI color code, i.e. that it consists of one or more
|
||||||
|
|||||||
@ -9,9 +9,17 @@ typedef enum ColorMode {
|
|||||||
COLOR_16, /* Only the base 16 colors. */
|
COLOR_16, /* Only the base 16 colors. */
|
||||||
COLOR_256, /* Only 256 colors. */
|
COLOR_256, /* Only 256 colors. */
|
||||||
COLOR_24BIT, /* For truecolor or 24bit color support, no restriction. */
|
COLOR_24BIT, /* For truecolor or 24bit color support, no restriction. */
|
||||||
COLOR_AUTO_16, /* The "AUTO" modes are as the above, but subject to suitable settings for */
|
_COLOR_MODE_FIXED_MAX,
|
||||||
COLOR_AUTO_256, /* the environment variables TERM and NO_COLOR. */
|
|
||||||
|
/* The "AUTO" modes are as the above, but subject to suitable settings for the environment variables
|
||||||
|
* TERM and NO_COLOR. */
|
||||||
|
COLOR_AUTO_16 = _COLOR_MODE_FIXED_MAX,
|
||||||
|
COLOR_AUTO_256,
|
||||||
COLOR_AUTO_24BIT,
|
COLOR_AUTO_24BIT,
|
||||||
|
|
||||||
|
/* Same as default (unset), except that $NO_COLOR is ignored/overridden */
|
||||||
|
COLOR_TRUE,
|
||||||
|
|
||||||
_COLOR_MODE_MAX,
|
_COLOR_MODE_MAX,
|
||||||
_COLOR_MODE_INVALID = -EINVAL,
|
_COLOR_MODE_INVALID = -EINVAL,
|
||||||
} ColorMode;
|
} ColorMode;
|
||||||
|
|||||||
@ -24,7 +24,7 @@ int errno_from_name(const char *name) {
|
|||||||
return sc->id;
|
return sc->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAVE_STRERRORNAME_NP
|
#ifdef __GLIBC__
|
||||||
const char* errno_name_no_fallback(int id) {
|
const char* errno_name_no_fallback(int id) {
|
||||||
if (id == 0) /* To stay in line with our implementation below. */
|
if (id == 0) /* To stay in line with our implementation below. */
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@ -1,27 +1,26 @@
|
|||||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include_next <malloc.h>
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
/* struct mallinfo2 will be defined and struct mallinfo is converted to struct mallinfo2 in
|
struct mallinfo2 {
|
||||||
* override/malloc.h. Hence, here we define struct mallinfo. */
|
size_t arena; /* non-mmapped space allocated from system */
|
||||||
|
size_t ordblks; /* number of free chunks */
|
||||||
struct mallinfo {
|
size_t smblks; /* number of fastbin blocks */
|
||||||
int arena; /* non-mmapped space allocated from system */
|
size_t hblks; /* number of mmapped regions */
|
||||||
int ordblks; /* number of free chunks */
|
size_t hblkhd; /* space in mmapped regions */
|
||||||
int smblks; /* number of fastbin blocks */
|
size_t usmblks; /* always 0, preserved for backwards compatibility */
|
||||||
int hblks; /* number of mmapped regions */
|
size_t fsmblks; /* space available in freed fastbin blocks */
|
||||||
int hblkhd; /* space in mmapped regions */
|
size_t uordblks; /* total allocated space */
|
||||||
int usmblks; /* always 0, preserved for backwards compatibility */
|
size_t fordblks; /* total free space */
|
||||||
int fsmblks; /* space available in freed fastbin blocks */
|
size_t keepcost; /* top-most, releasable (via malloc_trim) space */
|
||||||
int uordblks; /* total allocated space */
|
|
||||||
int fordblks; /* total free space */
|
|
||||||
int keepcost; /* top-most, releasable (via malloc_trim) space */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline struct mallinfo mallinfo(void) {
|
static inline struct mallinfo2 mallinfo2(void) {
|
||||||
return (struct mallinfo) {};
|
return (struct mallinfo2) {};
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int malloc_info(int options, FILE *stream) {
|
static inline int malloc_info(int options, FILE *stream) {
|
||||||
@ -35,5 +34,3 @@ static inline int malloc_info(int options, FILE *stream) {
|
|||||||
static inline int malloc_trim(size_t pad) {
|
static inline int malloc_trim(size_t pad) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#include_next <malloc.h>
|
|
||||||
|
|||||||
@ -10,3 +10,9 @@
|
|||||||
* found. Let's always use getopt_long(). */
|
* found. Let's always use getopt_long(). */
|
||||||
int getopt_fix(int argc, char * const *argv, const char *optstring);
|
int getopt_fix(int argc, char * const *argv, const char *optstring);
|
||||||
#define getopt(argc, argv, optstring) getopt_fix(argc, argv, optstring)
|
#define getopt(argc, argv, optstring) getopt_fix(argc, argv, optstring)
|
||||||
|
|
||||||
|
int missing_close_range(unsigned first_fd, unsigned end_fd, unsigned flags);
|
||||||
|
#define close_range missing_close_range
|
||||||
|
|
||||||
|
int missing_execveat(int dirfd, const char *pathname, char * const argv[], char * const envp[], int flags);
|
||||||
|
#define execveat missing_execveat
|
||||||
|
|||||||
@ -1,39 +0,0 @@
|
|||||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include_next <malloc.h> /* IWYU pragma: export */
|
|
||||||
|
|
||||||
#if !HAVE_MALLINFO2
|
|
||||||
struct mallinfo2 {
|
|
||||||
size_t arena; /* non-mmapped space allocated from system */
|
|
||||||
size_t ordblks; /* number of free chunks */
|
|
||||||
size_t smblks; /* number of fastbin blocks */
|
|
||||||
size_t hblks; /* number of mmapped regions */
|
|
||||||
size_t hblkhd; /* space in mmapped regions */
|
|
||||||
size_t usmblks; /* always 0, preserved for backwards compatibility */
|
|
||||||
size_t fsmblks; /* space available in freed fastbin blocks */
|
|
||||||
size_t uordblks; /* total allocated space */
|
|
||||||
size_t fordblks; /* total free space */
|
|
||||||
size_t keepcost; /* top-most, releasable (via malloc_trim) space */
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline struct mallinfo2 mallinfo2(void) {
|
|
||||||
_Pragma("GCC diagnostic push");
|
|
||||||
_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"");
|
|
||||||
struct mallinfo m = mallinfo();
|
|
||||||
_Pragma("GCC diagnostic pop");
|
|
||||||
|
|
||||||
return (struct mallinfo2) {
|
|
||||||
.arena = m.arena,
|
|
||||||
.ordblks = m.ordblks,
|
|
||||||
.smblks = m.smblks,
|
|
||||||
.hblks = m.hblks,
|
|
||||||
.hblkhd = m.hblkhd,
|
|
||||||
.usmblks = 0,
|
|
||||||
.fsmblks = m.fsmblks,
|
|
||||||
.uordblks = m.uordblks,
|
|
||||||
.fordblks = m.fordblks,
|
|
||||||
.keepcost = m.keepcost,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
@ -6,11 +6,8 @@ import functools
|
|||||||
|
|
||||||
# We only generate numbers for a dozen or so syscalls
|
# We only generate numbers for a dozen or so syscalls
|
||||||
SYSCALLS = [
|
SYSCALLS = [
|
||||||
'close_range', # defined in glibc header since glibc-2.33
|
|
||||||
'fchmodat2', # defined in glibc header since glibc-2.39
|
'fchmodat2', # defined in glibc header since glibc-2.39
|
||||||
'mount_setattr', # defined in glibc header since glibc-2.34
|
|
||||||
'open_tree_attr',
|
'open_tree_attr',
|
||||||
'openat2', # defined in glibc header since glibc-2.32
|
|
||||||
'quotactl_fd', # defined in glibc header since glibc-2.35
|
'quotactl_fd', # defined in glibc header since glibc-2.35
|
||||||
'removexattrat',
|
'removexattrat',
|
||||||
'setxattrat',
|
'setxattrat',
|
||||||
|
|||||||
@ -1,13 +0,0 @@
|
|||||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include_next <sys/random.h> /* IWYU pragma: export */
|
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
/* Defined since glibc-2.32. */
|
|
||||||
#ifndef GRND_INSECURE
|
|
||||||
# define GRND_INSECURE 0x0004
|
|
||||||
#else
|
|
||||||
static_assert(GRND_INSECURE == 0x0004, "");
|
|
||||||
#endif
|
|
||||||
@ -54,76 +54,6 @@
|
|||||||
# define missing_arch_template 1
|
# define missing_arch_template 1
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
#ifndef __IGNORE_close_range
|
|
||||||
# if defined(__aarch64__)
|
|
||||||
# define systemd_NR_close_range 436
|
|
||||||
# elif defined(__alpha__)
|
|
||||||
# define systemd_NR_close_range 546
|
|
||||||
# elif defined(__arc__) || defined(__tilegx__)
|
|
||||||
# define systemd_NR_close_range 436
|
|
||||||
# elif defined(__arm__)
|
|
||||||
# define systemd_NR_close_range 436
|
|
||||||
# elif defined(__i386__)
|
|
||||||
# define systemd_NR_close_range 436
|
|
||||||
# elif defined(__ia64__)
|
|
||||||
# define systemd_NR_close_range 1460
|
|
||||||
# elif defined(__loongarch_lp64)
|
|
||||||
# define systemd_NR_close_range 436
|
|
||||||
# elif defined(__m68k__)
|
|
||||||
# define systemd_NR_close_range 436
|
|
||||||
# elif defined(_MIPS_SIM)
|
|
||||||
# if _MIPS_SIM == _MIPS_SIM_ABI32
|
|
||||||
# define systemd_NR_close_range 4436
|
|
||||||
# elif _MIPS_SIM == _MIPS_SIM_NABI32
|
|
||||||
# define systemd_NR_close_range 6436
|
|
||||||
# elif _MIPS_SIM == _MIPS_SIM_ABI64
|
|
||||||
# define systemd_NR_close_range 5436
|
|
||||||
# else
|
|
||||||
# error "Unknown MIPS ABI"
|
|
||||||
# endif
|
|
||||||
# elif defined(__hppa__)
|
|
||||||
# define systemd_NR_close_range 436
|
|
||||||
# elif defined(__powerpc__)
|
|
||||||
# define systemd_NR_close_range 436
|
|
||||||
# elif defined(__riscv)
|
|
||||||
# if __riscv_xlen == 32
|
|
||||||
# define systemd_NR_close_range 436
|
|
||||||
# elif __riscv_xlen == 64
|
|
||||||
# define systemd_NR_close_range 436
|
|
||||||
# else
|
|
||||||
# error "Unknown RISC-V ABI"
|
|
||||||
# endif
|
|
||||||
# elif defined(__s390__)
|
|
||||||
# define systemd_NR_close_range 436
|
|
||||||
# elif defined(__sh__)
|
|
||||||
# define systemd_NR_close_range 436
|
|
||||||
# elif defined(__sparc__)
|
|
||||||
# define systemd_NR_close_range 436
|
|
||||||
# elif defined(__x86_64__)
|
|
||||||
# if defined(__ILP32__)
|
|
||||||
# define systemd_NR_close_range (436 | /* __X32_SYSCALL_BIT */ 0x40000000)
|
|
||||||
# else
|
|
||||||
# define systemd_NR_close_range 436
|
|
||||||
# endif
|
|
||||||
# elif !defined(missing_arch_template)
|
|
||||||
# warning "close_range() syscall number is unknown for your architecture"
|
|
||||||
# endif
|
|
||||||
|
|
||||||
/* may be an (invalid) negative number due to libseccomp, see PR 13319 */
|
|
||||||
# if defined __NR_close_range && __NR_close_range >= 0
|
|
||||||
# if defined systemd_NR_close_range
|
|
||||||
static_assert(__NR_close_range == systemd_NR_close_range, "");
|
|
||||||
# endif
|
|
||||||
# else
|
|
||||||
# if defined __NR_close_range
|
|
||||||
# undef __NR_close_range
|
|
||||||
# endif
|
|
||||||
# if defined systemd_NR_close_range && systemd_NR_close_range >= 0
|
|
||||||
# define __NR_close_range systemd_NR_close_range
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __IGNORE_fchmodat2
|
#ifndef __IGNORE_fchmodat2
|
||||||
# if defined(__aarch64__)
|
# if defined(__aarch64__)
|
||||||
# define systemd_NR_fchmodat2 452
|
# define systemd_NR_fchmodat2 452
|
||||||
@ -194,76 +124,6 @@ static_assert(__NR_fchmodat2 == systemd_NR_fchmodat2, "");
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __IGNORE_mount_setattr
|
|
||||||
# if defined(__aarch64__)
|
|
||||||
# define systemd_NR_mount_setattr 442
|
|
||||||
# elif defined(__alpha__)
|
|
||||||
# define systemd_NR_mount_setattr 552
|
|
||||||
# elif defined(__arc__) || defined(__tilegx__)
|
|
||||||
# define systemd_NR_mount_setattr 442
|
|
||||||
# elif defined(__arm__)
|
|
||||||
# define systemd_NR_mount_setattr 442
|
|
||||||
# elif defined(__i386__)
|
|
||||||
# define systemd_NR_mount_setattr 442
|
|
||||||
# elif defined(__ia64__)
|
|
||||||
# define systemd_NR_mount_setattr 1466
|
|
||||||
# elif defined(__loongarch_lp64)
|
|
||||||
# define systemd_NR_mount_setattr 442
|
|
||||||
# elif defined(__m68k__)
|
|
||||||
# define systemd_NR_mount_setattr 442
|
|
||||||
# elif defined(_MIPS_SIM)
|
|
||||||
# if _MIPS_SIM == _MIPS_SIM_ABI32
|
|
||||||
# define systemd_NR_mount_setattr 4442
|
|
||||||
# elif _MIPS_SIM == _MIPS_SIM_NABI32
|
|
||||||
# define systemd_NR_mount_setattr 6442
|
|
||||||
# elif _MIPS_SIM == _MIPS_SIM_ABI64
|
|
||||||
# define systemd_NR_mount_setattr 5442
|
|
||||||
# else
|
|
||||||
# error "Unknown MIPS ABI"
|
|
||||||
# endif
|
|
||||||
# elif defined(__hppa__)
|
|
||||||
# define systemd_NR_mount_setattr 442
|
|
||||||
# elif defined(__powerpc__)
|
|
||||||
# define systemd_NR_mount_setattr 442
|
|
||||||
# elif defined(__riscv)
|
|
||||||
# if __riscv_xlen == 32
|
|
||||||
# define systemd_NR_mount_setattr 442
|
|
||||||
# elif __riscv_xlen == 64
|
|
||||||
# define systemd_NR_mount_setattr 442
|
|
||||||
# else
|
|
||||||
# error "Unknown RISC-V ABI"
|
|
||||||
# endif
|
|
||||||
# elif defined(__s390__)
|
|
||||||
# define systemd_NR_mount_setattr 442
|
|
||||||
# elif defined(__sh__)
|
|
||||||
# define systemd_NR_mount_setattr 442
|
|
||||||
# elif defined(__sparc__)
|
|
||||||
# define systemd_NR_mount_setattr 442
|
|
||||||
# elif defined(__x86_64__)
|
|
||||||
# if defined(__ILP32__)
|
|
||||||
# define systemd_NR_mount_setattr (442 | /* __X32_SYSCALL_BIT */ 0x40000000)
|
|
||||||
# else
|
|
||||||
# define systemd_NR_mount_setattr 442
|
|
||||||
# endif
|
|
||||||
# elif !defined(missing_arch_template)
|
|
||||||
# warning "mount_setattr() syscall number is unknown for your architecture"
|
|
||||||
# endif
|
|
||||||
|
|
||||||
/* may be an (invalid) negative number due to libseccomp, see PR 13319 */
|
|
||||||
# if defined __NR_mount_setattr && __NR_mount_setattr >= 0
|
|
||||||
# if defined systemd_NR_mount_setattr
|
|
||||||
static_assert(__NR_mount_setattr == systemd_NR_mount_setattr, "");
|
|
||||||
# endif
|
|
||||||
# else
|
|
||||||
# if defined __NR_mount_setattr
|
|
||||||
# undef __NR_mount_setattr
|
|
||||||
# endif
|
|
||||||
# if defined systemd_NR_mount_setattr && systemd_NR_mount_setattr >= 0
|
|
||||||
# define __NR_mount_setattr systemd_NR_mount_setattr
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __IGNORE_open_tree_attr
|
#ifndef __IGNORE_open_tree_attr
|
||||||
# if defined(__aarch64__)
|
# if defined(__aarch64__)
|
||||||
# define systemd_NR_open_tree_attr 467
|
# define systemd_NR_open_tree_attr 467
|
||||||
@ -334,76 +194,6 @@ static_assert(__NR_open_tree_attr == systemd_NR_open_tree_attr, "");
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __IGNORE_openat2
|
|
||||||
# if defined(__aarch64__)
|
|
||||||
# define systemd_NR_openat2 437
|
|
||||||
# elif defined(__alpha__)
|
|
||||||
# define systemd_NR_openat2 547
|
|
||||||
# elif defined(__arc__) || defined(__tilegx__)
|
|
||||||
# define systemd_NR_openat2 437
|
|
||||||
# elif defined(__arm__)
|
|
||||||
# define systemd_NR_openat2 437
|
|
||||||
# elif defined(__i386__)
|
|
||||||
# define systemd_NR_openat2 437
|
|
||||||
# elif defined(__ia64__)
|
|
||||||
# define systemd_NR_openat2 1461
|
|
||||||
# elif defined(__loongarch_lp64)
|
|
||||||
# define systemd_NR_openat2 437
|
|
||||||
# elif defined(__m68k__)
|
|
||||||
# define systemd_NR_openat2 437
|
|
||||||
# elif defined(_MIPS_SIM)
|
|
||||||
# if _MIPS_SIM == _MIPS_SIM_ABI32
|
|
||||||
# define systemd_NR_openat2 4437
|
|
||||||
# elif _MIPS_SIM == _MIPS_SIM_NABI32
|
|
||||||
# define systemd_NR_openat2 6437
|
|
||||||
# elif _MIPS_SIM == _MIPS_SIM_ABI64
|
|
||||||
# define systemd_NR_openat2 5437
|
|
||||||
# else
|
|
||||||
# error "Unknown MIPS ABI"
|
|
||||||
# endif
|
|
||||||
# elif defined(__hppa__)
|
|
||||||
# define systemd_NR_openat2 437
|
|
||||||
# elif defined(__powerpc__)
|
|
||||||
# define systemd_NR_openat2 437
|
|
||||||
# elif defined(__riscv)
|
|
||||||
# if __riscv_xlen == 32
|
|
||||||
# define systemd_NR_openat2 437
|
|
||||||
# elif __riscv_xlen == 64
|
|
||||||
# define systemd_NR_openat2 437
|
|
||||||
# else
|
|
||||||
# error "Unknown RISC-V ABI"
|
|
||||||
# endif
|
|
||||||
# elif defined(__s390__)
|
|
||||||
# define systemd_NR_openat2 437
|
|
||||||
# elif defined(__sh__)
|
|
||||||
# define systemd_NR_openat2 437
|
|
||||||
# elif defined(__sparc__)
|
|
||||||
# define systemd_NR_openat2 437
|
|
||||||
# elif defined(__x86_64__)
|
|
||||||
# if defined(__ILP32__)
|
|
||||||
# define systemd_NR_openat2 (437 | /* __X32_SYSCALL_BIT */ 0x40000000)
|
|
||||||
# else
|
|
||||||
# define systemd_NR_openat2 437
|
|
||||||
# endif
|
|
||||||
# elif !defined(missing_arch_template)
|
|
||||||
# warning "openat2() syscall number is unknown for your architecture"
|
|
||||||
# endif
|
|
||||||
|
|
||||||
/* may be an (invalid) negative number due to libseccomp, see PR 13319 */
|
|
||||||
# if defined __NR_openat2 && __NR_openat2 >= 0
|
|
||||||
# if defined systemd_NR_openat2
|
|
||||||
static_assert(__NR_openat2 == systemd_NR_openat2, "");
|
|
||||||
# endif
|
|
||||||
# else
|
|
||||||
# if defined __NR_openat2
|
|
||||||
# undef __NR_openat2
|
|
||||||
# endif
|
|
||||||
# if defined systemd_NR_openat2 && systemd_NR_openat2 >= 0
|
|
||||||
# define __NR_openat2 systemd_NR_openat2
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __IGNORE_quotactl_fd
|
#ifndef __IGNORE_quotactl_fd
|
||||||
# if defined(__aarch64__)
|
# if defined(__aarch64__)
|
||||||
# define systemd_NR_quotactl_fd 443
|
# define systemd_NR_quotactl_fd 443
|
||||||
|
|||||||
@ -3,20 +3,6 @@
|
|||||||
|
|
||||||
#include_next <unistd.h> /* IWYU pragma: export */
|
#include_next <unistd.h> /* IWYU pragma: export */
|
||||||
|
|
||||||
/* Defined since glibc-2.34.
|
|
||||||
* Supported since kernel v5.9 (9b4feb630e8e9801603f3cab3a36369e3c1cf88d). */
|
|
||||||
#if !HAVE_CLOSE_RANGE
|
|
||||||
int missing_close_range(unsigned first_fd, unsigned end_fd, unsigned flags);
|
|
||||||
# define close_range missing_close_range
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Defined since glibc-2.34.
|
|
||||||
* Supported since kernel v3.19 (51f39a1f0cea1cacf8c787f652f26dfee9611874). */
|
|
||||||
#if !HAVE_EXECVEAT
|
|
||||||
int missing_execveat(int dirfd, const char *pathname, char * const argv[], char * const envp[], int flags);
|
|
||||||
# define execveat missing_execveat
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !HAVE_PIVOT_ROOT
|
#if !HAVE_PIVOT_ROOT
|
||||||
int missing_pivot_root(const char *new_root, const char *put_old);
|
int missing_pivot_root(const char *new_root, const char *put_old);
|
||||||
# define pivot_root missing_pivot_root
|
# define pivot_root missing_pivot_root
|
||||||
|
|||||||
@ -11,4 +11,5 @@ libc_wrapper_sources += files(
|
|||||||
'stdio.c',
|
'stdio.c',
|
||||||
'stdlib.c',
|
'stdlib.c',
|
||||||
'string.c',
|
'string.c',
|
||||||
|
'unistd.c',
|
||||||
)
|
)
|
||||||
|
|||||||
15
src/libc/musl/unistd.c
Normal file
15
src/libc/musl/unistd.c
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||||
|
|
||||||
|
#include <sys/syscall.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int missing_close_range(unsigned first_fd, unsigned end_fd, unsigned flags) {
|
||||||
|
/* Kernel-side the syscall expects fds as unsigned integers (just like close() actually), while
|
||||||
|
* userspace exclusively uses signed integers for fds. glibc chose to expose it 1:1 however, hence we
|
||||||
|
* do so here too, even if we end up passing signed fds to it most of the time. */
|
||||||
|
return syscall(__NR_close_range, first_fd, end_fd, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
int missing_execveat(int dirfd, const char *pathname, char * const argv[], char * const envp[], int flags) {
|
||||||
|
return syscall(__NR_execveat, dirfd, pathname, argv, envp, flags);
|
||||||
|
}
|
||||||
@ -3,21 +3,6 @@
|
|||||||
#include <sys/syscall.h>
|
#include <sys/syscall.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#if !HAVE_CLOSE_RANGE
|
|
||||||
int missing_close_range(unsigned first_fd, unsigned end_fd, unsigned flags) {
|
|
||||||
/* Kernel-side the syscall expects fds as unsigned integers (just like close() actually), while
|
|
||||||
* userspace exclusively uses signed integers for fds. glibc chose to expose it 1:1 however, hence we
|
|
||||||
* do so here too, even if we end up passing signed fds to it most of the time. */
|
|
||||||
return syscall(__NR_close_range, first_fd, end_fd, flags);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !HAVE_EXECVEAT
|
|
||||||
int missing_execveat(int dirfd, const char *pathname, char * const argv[], char * const envp[], int flags) {
|
|
||||||
return syscall(__NR_execveat, dirfd, pathname, argv, envp, flags);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !HAVE_PIVOT_ROOT
|
#if !HAVE_PIVOT_ROOT
|
||||||
int missing_pivot_root(const char *new_root, const char *put_old) {
|
int missing_pivot_root(const char *new_root, const char *put_old) {
|
||||||
return syscall(__NR_pivot_root, new_root, put_old);
|
return syscall(__NR_pivot_root, new_root, put_old);
|
||||||
|
|||||||
@ -4210,15 +4210,19 @@ static int message_parse_fields(sd_bus_message *m, bool got_ctrunc) {
|
|||||||
"Received a bus message with too many fds: %" PRIu32 " received vs. %" PRIu32 " declared",
|
"Received a bus message with too many fds: %" PRIu32 " received vs. %" PRIu32 " declared",
|
||||||
m->n_fds, n_unix_fds_declared);
|
m->n_fds, n_unix_fds_declared);
|
||||||
|
|
||||||
if (m->n_fds < n_unix_fds_declared && !got_ctrunc)
|
if (m->n_fds < n_unix_fds_declared) {
|
||||||
|
if (!got_ctrunc)
|
||||||
return log_error_errno(SYNTHETIC_ERRNO(EBADMSG),
|
return log_error_errno(SYNTHETIC_ERRNO(EBADMSG),
|
||||||
"Received a bus message with too few fds: %" PRIu32 " received vs. %" PRIu32 " declared",
|
"Received a bus message with too few fds: %" PRIu32 " received vs. %" PRIu32 " declared",
|
||||||
m->n_fds, n_unix_fds_declared);
|
m->n_fds, n_unix_fds_declared);
|
||||||
|
|
||||||
if (got_ctrunc)
|
|
||||||
log_error("Received a bus message with MSG_CTRUNC set with %" PRIu32 " fds received vs %" PRIu32 " declared",
|
log_error("Received a bus message with MSG_CTRUNC set with %" PRIu32 " fds received vs %" PRIu32 " declared",
|
||||||
m->n_fds, n_unix_fds_declared);
|
m->n_fds, n_unix_fds_declared);
|
||||||
|
|
||||||
|
} else if (got_ctrunc)
|
||||||
|
return log_error_errno(SYNTHETIC_ERRNO(EBADMSG),
|
||||||
|
"Received a bus message with truncated control data, refusing.");
|
||||||
|
|
||||||
switch (m->header->type) {
|
switch (m->header->type) {
|
||||||
|
|
||||||
case SD_BUS_MESSAGE_SIGNAL:
|
case SD_BUS_MESSAGE_SIGNAL:
|
||||||
|
|||||||
@ -657,7 +657,7 @@ static int bus_socket_read_auth(sd_bus *b) {
|
|||||||
.msg_controllen = sizeof(control),
|
.msg_controllen = sizeof(control),
|
||||||
};
|
};
|
||||||
|
|
||||||
k = RET_NERRNO(recvmsg(b->input_fd, &mh, MSG_DONTWAIT|MSG_CMSG_CLOEXEC));
|
k = recvmsg_safe(b->input_fd, &mh, MSG_DONTWAIT|MSG_CMSG_CLOEXEC);
|
||||||
if (k == -ENOTSOCK) {
|
if (k == -ENOTSOCK) {
|
||||||
b->prefer_readv = true;
|
b->prefer_readv = true;
|
||||||
k = readv(b->input_fd, &iov, 1);
|
k = readv(b->input_fd, &iov, 1);
|
||||||
@ -1397,14 +1397,8 @@ static int bus_socket_make_message(sd_bus *bus, size_t size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int bus_socket_read_message(sd_bus *bus) {
|
int bus_socket_read_message(sd_bus *bus) {
|
||||||
struct msghdr mh;
|
|
||||||
struct iovec iov = {};
|
|
||||||
ssize_t k;
|
|
||||||
size_t need;
|
size_t need;
|
||||||
int r;
|
int r;
|
||||||
void *b;
|
|
||||||
CMSG_BUFFER_TYPE(CMSG_SPACE(sizeof(int) * BUS_FDS_MAX)) control;
|
|
||||||
bool handle_cmsg = false;
|
|
||||||
|
|
||||||
assert(bus);
|
assert(bus);
|
||||||
assert(IN_SET(bus->state, BUS_RUNNING, BUS_HELLO));
|
assert(IN_SET(bus->state, BUS_RUNNING, BUS_HELLO));
|
||||||
@ -1416,19 +1410,18 @@ int bus_socket_read_message(sd_bus *bus) {
|
|||||||
if (bus->rbuffer_size >= need)
|
if (bus->rbuffer_size >= need)
|
||||||
return bus_socket_make_message(bus, need);
|
return bus_socket_make_message(bus, need);
|
||||||
|
|
||||||
b = realloc(bus->rbuffer, need);
|
void *b = realloc(bus->rbuffer, need);
|
||||||
if (!b)
|
if (!b)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
bus->rbuffer = b;
|
bus->rbuffer = b;
|
||||||
|
|
||||||
iov = IOVEC_MAKE((uint8_t *)bus->rbuffer + bus->rbuffer_size, need - bus->rbuffer_size);
|
struct iovec iov = IOVEC_MAKE((uint8_t*) bus->rbuffer + bus->rbuffer_size, need - bus->rbuffer_size);
|
||||||
|
CMSG_BUFFER_TYPE(CMSG_SPACE(sizeof(int) * BUS_FDS_MAX)) control;
|
||||||
|
struct msghdr mh;
|
||||||
|
bool handle_cmsg = false;
|
||||||
|
ssize_t k;
|
||||||
|
|
||||||
if (bus->prefer_readv) {
|
if (!bus->prefer_readv) {
|
||||||
k = readv(bus->input_fd, &iov, 1);
|
|
||||||
if (k < 0)
|
|
||||||
k = -errno;
|
|
||||||
} else {
|
|
||||||
mh = (struct msghdr) {
|
mh = (struct msghdr) {
|
||||||
.msg_iov = &iov,
|
.msg_iov = &iov,
|
||||||
.msg_iovlen = 1,
|
.msg_iovlen = 1,
|
||||||
@ -1436,24 +1429,29 @@ int bus_socket_read_message(sd_bus *bus) {
|
|||||||
.msg_controllen = sizeof(control),
|
.msg_controllen = sizeof(control),
|
||||||
};
|
};
|
||||||
|
|
||||||
k = RET_NERRNO(recvmsg(bus->input_fd, &mh, MSG_DONTWAIT|MSG_CMSG_CLOEXEC));
|
k = recvmsg(bus->input_fd, &mh, MSG_DONTWAIT|MSG_CMSG_CLOEXEC);
|
||||||
if (k == -ENOTSOCK) {
|
if (k < 0 && errno == ENOTSOCK)
|
||||||
bus->prefer_readv = true;
|
bus->prefer_readv = true;
|
||||||
k = readv(bus->input_fd, &iov, 1);
|
else
|
||||||
if (k < 0)
|
|
||||||
k = -errno;
|
|
||||||
} else
|
|
||||||
handle_cmsg = true;
|
handle_cmsg = true;
|
||||||
}
|
}
|
||||||
if (ERRNO_IS_NEG_TRANSIENT(k))
|
if (bus->prefer_readv)
|
||||||
|
k = readv(bus->input_fd, &iov, 1);
|
||||||
|
if (k < 0) {
|
||||||
|
if (ERRNO_IS_TRANSIENT(errno))
|
||||||
return 0;
|
return 0;
|
||||||
if (k < 0)
|
|
||||||
return (int) k;
|
return -errno;
|
||||||
|
}
|
||||||
if (k == 0) {
|
if (k == 0) {
|
||||||
if (handle_cmsg)
|
if (handle_cmsg)
|
||||||
cmsg_close_all(&mh); /* On EOF we shouldn't have gotten an fd, but let's make sure */
|
cmsg_close_all(&mh); /* On EOF we shouldn't have gotten an fd, but let's make sure */
|
||||||
return -ECONNRESET;
|
return -ECONNRESET;
|
||||||
}
|
}
|
||||||
|
if (handle_cmsg && FLAGS_SET(mh.msg_flags, MSG_TRUNC)) {
|
||||||
|
cmsg_close_all(&mh);
|
||||||
|
return -EXFULL;
|
||||||
|
}
|
||||||
|
|
||||||
bus->rbuffer_size += k;
|
bus->rbuffer_size += k;
|
||||||
|
|
||||||
|
|||||||
@ -2743,7 +2743,7 @@ int dissected_image_mount(
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_debug_errno(r, "Failed to check is '%s' is an OS tree: %m", where);
|
return log_debug_errno(r, "Failed to check is '%s' is an OS tree: %m", where);
|
||||||
if (r > 0) {
|
if (r > 0) {
|
||||||
log_debug("Succesfully identified '%s' as an OS tree", where);
|
log_debug("Successfully identified '%s' as an OS tree", where);
|
||||||
ok = true;
|
ok = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
typedef enum TableDataType {
|
typedef enum TableDataType {
|
||||||
TABLE_EMPTY,
|
TABLE_EMPTY,
|
||||||
TABLE_STRING,
|
TABLE_STRING,
|
||||||
TABLE_STRING_WITH_ANSI, /* like the above, but contains ANSI sequences/TABs. They will be stripped when outputing to JSON */
|
TABLE_STRING_WITH_ANSI, /* like the above, but contains ANSI sequences/TABs. They will be stripped when outputting to JSON */
|
||||||
TABLE_HEADER, /* in regular mode: the cells in the first row, that carry the column names */
|
TABLE_HEADER, /* in regular mode: the cells in the first row, that carry the column names */
|
||||||
TABLE_FIELD, /* in vertical mode: the cells in the first column, that carry the field names */
|
TABLE_FIELD, /* in vertical mode: the cells in the first column, that carry the field names */
|
||||||
TABLE_STRV,
|
TABLE_STRV,
|
||||||
|
|||||||
@ -256,7 +256,7 @@ static int reread_partition_table_full(sd_device *dev, int fd, RereadPartitionTa
|
|||||||
if (FLAGS_SET(flags, REREADPT_BSD_LOCK)) {
|
if (FLAGS_SET(flags, REREADPT_BSD_LOCK)) {
|
||||||
lock_fd = fd_reopen(fd, O_RDONLY|O_CLOEXEC|O_NOCTTY);
|
lock_fd = fd_reopen(fd, O_RDONLY|O_CLOEXEC|O_NOCTTY);
|
||||||
if (lock_fd < 0)
|
if (lock_fd < 0)
|
||||||
return log_device_debug_errno(dev, lock_fd, "Failed top open lock fd for block device '%s': %m", p);
|
return log_device_debug_errno(dev, lock_fd, "Failed to open lock fd for block device '%s': %m", p);
|
||||||
|
|
||||||
if (flock(lock_fd, LOCK_EX|LOCK_NB) < 0) {
|
if (flock(lock_fd, LOCK_EX|LOCK_NB) < 0) {
|
||||||
r = log_device_debug_errno(dev, errno, "Failed to take BSD lock on block device '%s': %m", p);
|
r = log_device_debug_errno(dev, errno, "Failed to take BSD lock on block device '%s': %m", p);
|
||||||
|
|||||||
@ -923,7 +923,6 @@ static bool device_is_allowed(sd_device *d) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int device_added(Context *c, sd_device *device) {
|
static int device_added(Context *c, sd_device *device) {
|
||||||
_cleanup_close_ int fd = -EBADF;
|
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(c);
|
assert(c);
|
||||||
@ -967,7 +966,7 @@ static int device_added(Context *c, sd_device *device) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
fd = sd_device_open(device, O_RDONLY|O_CLOEXEC|O_NONBLOCK);
|
int fd = sd_device_open(device, O_RDWR|O_CLOEXEC|O_NONBLOCK);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
log_device_warning_errno(device, fd, "Failed to open newly acquired device '%s', ignoring device: %m", devname);
|
log_device_warning_errno(device, fd, "Failed to open newly acquired device '%s', ignoring device: %m", devname);
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@ -849,14 +849,18 @@ TEST(table_ansi) {
|
|||||||
TABLE_STRING_WITH_ANSI, ANSI_GREY "thisisgrey"));
|
TABLE_STRING_WITH_ANSI, ANSI_GREY "thisisgrey"));
|
||||||
|
|
||||||
unsigned saved_columns = columns();
|
unsigned saved_columns = columns();
|
||||||
bool saved_color = colors_enabled();
|
_cleanup_free_ char *saved_term = NULL, *saved_color = NULL;
|
||||||
_cleanup_free_ char *saved_term = NULL;
|
const char *e;
|
||||||
const char *e = getenv("TERM");
|
|
||||||
|
e = getenv("TERM");
|
||||||
if (e)
|
if (e)
|
||||||
ASSERT_NOT_NULL((saved_term = strdup(e)));
|
ASSERT_NOT_NULL((saved_term = strdup(e)));
|
||||||
|
e = getenv("SYSTEMD_COLORS");
|
||||||
|
if (e)
|
||||||
|
ASSERT_NOT_NULL((saved_color = strdup(e)));
|
||||||
|
|
||||||
ASSERT_OK_ERRNO(setenv("COLUMNS", "200", /* overwrite= */ true));
|
ASSERT_OK_ERRNO(setenv("COLUMNS", "200", /* overwrite= */ true));
|
||||||
ASSERT_OK_ERRNO(setenv("SYSTEMD_COLORS", "1", /* overwrite= */ true));
|
ASSERT_OK_ERRNO(setenv("SYSTEMD_COLORS", "24bit", /* overwrite= */ true));
|
||||||
ASSERT_OK_ERRNO(setenv("TERM", FALLBACK_TERM, /* overwrite= */ true));
|
ASSERT_OK_ERRNO(setenv("TERM", FALLBACK_TERM, /* overwrite= */ true));
|
||||||
reset_terminal_feature_caches();
|
reset_terminal_feature_caches();
|
||||||
|
|
||||||
@ -904,7 +908,7 @@ TEST(table_ansi) {
|
|||||||
ASSERT_OK(sd_json_variant_dump(j, SD_JSON_FORMAT_COLOR_AUTO|SD_JSON_FORMAT_PRETTY_AUTO, /* f= */ NULL, /* prefix= */ NULL));
|
ASSERT_OK(sd_json_variant_dump(j, SD_JSON_FORMAT_COLOR_AUTO|SD_JSON_FORMAT_PRETTY_AUTO, /* f= */ NULL, /* prefix= */ NULL));
|
||||||
|
|
||||||
ASSERT_OK(setenvf("COLUMNS", /* overwrite= */ true, "%u", saved_columns));
|
ASSERT_OK(setenvf("COLUMNS", /* overwrite= */ true, "%u", saved_columns));
|
||||||
ASSERT_OK(setenvf("SYSTEMD_COLORS", /* overwrite= */ true, "%i", saved_color));
|
ASSERT_OK(set_unset_env("SYSTEMD_COLORS", saved_color, /* overwrite= */ true));
|
||||||
ASSERT_OK(set_unset_env("TERM", saved_term, /* overwrite= */ true));
|
ASSERT_OK(set_unset_env("TERM", saved_term, /* overwrite= */ true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -11,7 +11,7 @@ static int run(int argc, char **argv) {
|
|||||||
|
|
||||||
test_setup_logging(LOG_DEBUG);
|
test_setup_logging(LOG_DEBUG);
|
||||||
|
|
||||||
assert_se(setenv("SYSTEMD_COLORS", "1", 1) == 0); /* Force the qrcode to be printed */
|
assert_se(setenv("SYSTEMD_COLORS", "24bit", 1) == 0); /* Force the qrcode to be printed */
|
||||||
|
|
||||||
r = print_qrcode(stdout, "This should say \"TEST\"", "TEST");
|
r = print_qrcode(stdout, "This should say \"TEST\"", "TEST");
|
||||||
if (r == -EOPNOTSUPP)
|
if (r == -EOPNOTSUPP)
|
||||||
|
|||||||
@ -332,18 +332,19 @@ TEST(get_color_mode) {
|
|||||||
test_get_color_mode_with_env("SYSTEMD_COLORS", "no", COLOR_OFF);
|
test_get_color_mode_with_env("SYSTEMD_COLORS", "no", COLOR_OFF);
|
||||||
test_get_color_mode_with_env("SYSTEMD_COLORS", "16", COLOR_16);
|
test_get_color_mode_with_env("SYSTEMD_COLORS", "16", COLOR_16);
|
||||||
test_get_color_mode_with_env("SYSTEMD_COLORS", "256", COLOR_256);
|
test_get_color_mode_with_env("SYSTEMD_COLORS", "256", COLOR_256);
|
||||||
test_get_color_mode_with_env("SYSTEMD_COLORS", "1", COLOR_24BIT);
|
|
||||||
test_get_color_mode_with_env("SYSTEMD_COLORS", "yes", COLOR_24BIT);
|
|
||||||
test_get_color_mode_with_env("SYSTEMD_COLORS", "24bit", COLOR_24BIT);
|
test_get_color_mode_with_env("SYSTEMD_COLORS", "24bit", COLOR_24BIT);
|
||||||
|
|
||||||
test_get_color_mode_with_env("SYSTEMD_COLORS", "auto-16", terminal_is_dumb() ? COLOR_OFF : COLOR_16);
|
test_get_color_mode_with_env("SYSTEMD_COLORS", "auto-16", terminal_is_dumb() ? COLOR_OFF : COLOR_16);
|
||||||
test_get_color_mode_with_env("SYSTEMD_COLORS", "auto-256", terminal_is_dumb() ? COLOR_OFF : COLOR_256);
|
test_get_color_mode_with_env("SYSTEMD_COLORS", "auto-256", terminal_is_dumb() ? COLOR_OFF : COLOR_256);
|
||||||
ASSERT_OK_ERRNO(setenv("COLORTERM", "truecolor", true));
|
|
||||||
test_get_color_mode_with_env("SYSTEMD_COLORS", "auto-24bit", terminal_is_dumb() ? COLOR_OFF : COLOR_24BIT);
|
test_get_color_mode_with_env("SYSTEMD_COLORS", "auto-24bit", terminal_is_dumb() ? COLOR_OFF : COLOR_24BIT);
|
||||||
|
ASSERT_OK_ERRNO(setenv("COLORTERM", "truecolor", true));
|
||||||
|
test_get_color_mode_with_env("SYSTEMD_COLORS", "1", terminal_is_dumb() ? COLOR_OFF : COLOR_24BIT);
|
||||||
|
test_get_color_mode_with_env("SYSTEMD_COLORS", "yes", terminal_is_dumb() ? COLOR_OFF : COLOR_24BIT);
|
||||||
ASSERT_OK_ERRNO(unsetenv("COLORTERM"));
|
ASSERT_OK_ERRNO(unsetenv("COLORTERM"));
|
||||||
test_get_color_mode_with_env("SYSTEMD_COLORS", "auto-24bit", terminal_is_dumb() ? COLOR_OFF : COLOR_256);
|
test_get_color_mode_with_env("SYSTEMD_COLORS", "true", terminal_is_dumb() ? COLOR_OFF : COLOR_256);
|
||||||
|
|
||||||
ASSERT_OK_ERRNO(setenv("NO_COLOR", "1", true));
|
ASSERT_OK_ERRNO(setenv("NO_COLOR", "1", true));
|
||||||
|
test_get_color_mode_with_env("SYSTEMD_COLORS", "true", terminal_is_dumb() ? COLOR_OFF : COLOR_256);
|
||||||
test_get_color_mode_with_env("SYSTEMD_COLORS", "auto-16", COLOR_OFF);
|
test_get_color_mode_with_env("SYSTEMD_COLORS", "auto-16", COLOR_OFF);
|
||||||
test_get_color_mode_with_env("SYSTEMD_COLORS", "auto-256", COLOR_OFF);
|
test_get_color_mode_with_env("SYSTEMD_COLORS", "auto-256", COLOR_OFF);
|
||||||
test_get_color_mode_with_env("SYSTEMD_COLORS", "auto-24bit", COLOR_OFF);
|
test_get_color_mode_with_env("SYSTEMD_COLORS", "auto-24bit", COLOR_OFF);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user