From 319507c595eab4409ae7d383a5d31c829233cab9 Mon Sep 17 00:00:00 2001 From: "Yury V. Zaytsev" Date: Sat, 1 Jun 2024 18:02:06 +0200 Subject: [PATCH 1/9] Ticket #4170: implement CI via GitHub Actions Signed-off-by: Yury V. Zaytsev --- .github/workflows/ci-alpine.yml | 46 ++++++++++++++ .github/workflows/ci-fedora.yml | 49 +++++++++++++++ .github/workflows/ci-freebsd.yml | 54 +++++++++++++++++ .github/workflows/ci-macos.yml | 47 +++++++++++++++ .github/workflows/ci-solaris.yml | 48 +++++++++++++++ .github/workflows/ci-ubuntu.yml | 100 +++++++++++++++++++++++++++++++ .github/workflows/ci.yml | 34 +++++++++++ 7 files changed, 378 insertions(+) create mode 100644 .github/workflows/ci-alpine.yml create mode 100644 .github/workflows/ci-fedora.yml create mode 100644 .github/workflows/ci-freebsd.yml create mode 100644 .github/workflows/ci-macos.yml create mode 100644 .github/workflows/ci-solaris.yml create mode 100644 .github/workflows/ci-ubuntu.yml create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci-alpine.yml b/.github/workflows/ci-alpine.yml new file mode 100644 index 0000000000..62aed5a0ac --- /dev/null +++ b/.github/workflows/ci-alpine.yml @@ -0,0 +1,46 @@ +name: ci-alpine + +on: + workflow_call: + +jobs: + build-alpine: + runs-on: ubuntu-latest + container: + image: alpine:latest + timeout-minutes: 5 + + steps: + - uses: actions/checkout@v4 + + - name: Install dependencies + run: | + apk add autoconf automake build-base libtool pkgconf sudo + apk add aspell-dev check-dev e2fsprogs-dev gettext-dev glib-dev gpm-dev libssh2-dev perl slang-dev + + - name: Bootstrap build system + run: ./autogen.sh + + - name: Build default configuration + run: | + adduser --home "$(pwd)" --no-create-home --disabled-password test + chown -R test "$(pwd)" + + su - test -c ' \ + ./configure \ + --prefix="$(pwd)/install-prefix" \ + --enable-mclib \ + --enable-aspell \ + --enable-werror \ + && \ + \ + make -j$(nproc) && \ + make check && \ + make install \ + ' + + - uses: actions/upload-artifact@v4 + if: failure() + with: + name: test-suite-logs-alpine + path: ./**/test-suite.log diff --git a/.github/workflows/ci-fedora.yml b/.github/workflows/ci-fedora.yml new file mode 100644 index 0000000000..1db5b5b93a --- /dev/null +++ b/.github/workflows/ci-fedora.yml @@ -0,0 +1,49 @@ +name: ci-fedora + +on: + workflow_call: + +jobs: + build-fedora: + runs-on: ubuntu-latest + container: + image: fedora:latest + timeout-minutes: 5 + + steps: + - uses: actions/checkout@v4 + + - name: Install dependencies + run: | + dnf install -y autoconf automake gcc gettext-devel libtool make pkgconfig + dnf install -y aspell-devel check-devel gpm-devel libX11-devel "pkgconfig(ext2fs)" "pkgconfig(glib-2.0)" "pkgconfig(gmodule-2.0)" "pkgconfig(libssh2)" "pkgconfig(slang)" + + # For tests + dnf install -y glibc-gconv-extra util-linux + + - name: Bootstrap build system + run: ./autogen.sh + + - name: Build default configuration + run: | + useradd --home "$(pwd)" test + chown -R test "$(pwd)" + + su - test -c ' \ + ./configure \ + --prefix="$(pwd)/install-prefix" \ + --enable-mclib \ + --enable-aspell \ + --enable-werror \ + && \ + \ + make -j$(nproc) && \ + make check && \ + make install \ + ' + + - uses: actions/upload-artifact@v4 + if: failure() + with: + name: test-suite-logs-fedora + path: ./**/test-suite.log diff --git a/.github/workflows/ci-freebsd.yml b/.github/workflows/ci-freebsd.yml new file mode 100644 index 0000000000..108587f27b --- /dev/null +++ b/.github/workflows/ci-freebsd.yml @@ -0,0 +1,54 @@ +name: ci-freebsd + +on: + workflow_call: + inputs: + CFLAGS: + description: 'Custom CFLAGS' + default: '' + required: false + type: string + +jobs: + build-freebsd: + runs-on: ubuntu-latest + timeout-minutes: 15 + + steps: + - uses: actions/checkout@v4 + + - name: Build on FreeBSD + uses: vmactions/freebsd-vm@v1 + with: + prepare: | + pkg install -y autoconf automake gettext libtool pkgconf + pkg install -y aspell check glib libssh2 libX11 + + run: | + ./autogen.sh + + pw useradd test -d "$(pwd)" + chown -R test $(pwd) + + su - test -c ' \ + \ + export CFLAGS="${{ inputs.CFLAGS }}" && \ + \ + ./configure \ + --prefix="$(pwd)/install-prefix" \ + --with-screen=ncurses \ + --enable-mclib \ + --enable-aspell \ + --enable-werror \ + && \ + \ + make && \ + make check && \ + make install \ + ' + + - uses: actions/upload-artifact@v4 + if: failure() + with: + name: test-suite-logs-freebsd + path: ./**/test-suite.log diff --git a/.github/workflows/ci-macos.yml b/.github/workflows/ci-macos.yml new file mode 100644 index 0000000000..42204e4661 --- /dev/null +++ b/.github/workflows/ci-macos.yml @@ -0,0 +1,47 @@ +name: ci-macos + +on: + workflow_call: + inputs: + CFLAGS: + description: 'Custom CFLAGS' + default: '' + required: false + type: string + +jobs: + build-macos: + runs-on: macos-latest + timeout-minutes: 5 + + steps: + - uses: actions/checkout@v4 + + - name: Install dependencies + run: | + brew install autoconf automake gettext check gnu-indent libtool pkg-config + brew install aspell e2fsprogs glib libssh2 openssl s-lang + + # unzip is part of the base system + + - name: Bootstrap build system + run: ./autogen.sh + + - name: Build default configuration + run: | + export CFLAGS="${{ inputs.CFLAGS }}" + + ./configure \ + --prefix="$(pwd)/install-prefix" \ + --enable-mclib \ + --enable-aspell=/opt/homebrew + + make -j$(sysctl -n hw.logicalcpu) + make check + make install + + - uses: actions/upload-artifact@v4 + if: failure() + with: + name: test-suite-logs-macos + path: ./**/test-suite.log diff --git a/.github/workflows/ci-solaris.yml b/.github/workflows/ci-solaris.yml new file mode 100644 index 0000000000..fc978b32ab --- /dev/null +++ b/.github/workflows/ci-solaris.yml @@ -0,0 +1,48 @@ +name: ci-solaris + +on: + workflow_call: + +jobs: + build-solaris: + runs-on: ubuntu-latest + timeout-minutes: 15 + + steps: + - uses: actions/checkout@v4 + + - name: Build on Solaris + uses: vmactions/solaris-vm@v1 + with: + release: "11.4-gcc" # autoconf automake developer/gcc/gcc-c libtool pkg-config + prepare: | + pkg install --no-backup-be --no-refresh --accept -v \ + aspell check glib2 libssh2 libx11 + + run: | + ./autogen.sh + + useradd -d "$(pwd)" test + chown -R test $(pwd) + + su - test -c ' \ + export PKG_CONFIG_PATH=/usr/lib/64/pkgconfig && \ + \ + ./configure \ + --prefix="$(pwd)/install-prefix" \ + --with-screen=ncurses \ + --enable-mclib \ + --enable-aspell \ + --enable-werror \ + && \ + \ + make && \ + make check && \ + make install \ + ' + + - uses: actions/upload-artifact@v4 + if: failure() + with: + name: test-suite-logs-solaris + path: ./**/test-suite.log diff --git a/.github/workflows/ci-ubuntu.yml b/.github/workflows/ci-ubuntu.yml new file mode 100644 index 0000000000..c68eac4f07 --- /dev/null +++ b/.github/workflows/ci-ubuntu.yml @@ -0,0 +1,100 @@ +name: ci-ubuntu + +on: + workflow_call: + +jobs: + build-ubuntu: + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - uses: actions/checkout@v4 + + - name: Install dependencies + run: | + sudo apt-get install -y autoconf autopoint check gettext indent libtool pkg-config + sudo apt-get install -y e2fslibs-dev libaspell-dev libglib2.0-dev libgpm-dev libncurses5-dev libpcre2-dev libslang2-dev libssh2-1-dev libx11-dev unzip + + - name: Bootstrap build system + run: ./autogen.sh + + - name: Build distribution archive + run: | + mkdir -p build-distrib && cd $_ + + ../configure + + make dist-bzip2 + + - name: Build full configuration + run: | + tar -xjf $(ls build-distrib/mc-*.tar.bz2) --one-top-level=build-full + cd build-full + + ../configure \ + --prefix="$(pwd)/install" \ + --enable-mclib \ + --enable-aspell \ + --enable-vfs-undelfs \ + --enable-werror + + make indent + # TODO: exit 1 + git ls-files --modified + + make -j$(nproc) + make check + make install + + - name: Build ncurses & pcre2 configuration + run: | + tar -xjf $(ls build-distrib/mc-*.tar.bz2) --one-top-level=build-ncurses + cd build-ncurses + + ../configure \ + --prefix="$(pwd)/install" \ + --with-screen=ncurses \ + --with-search-engine=pcre2 \ + --enable-werror + + make -j$(nproc) + make check + + - name: Build minimal configuration + run: | + tar -xjf $(ls build-distrib/mc-*.tar.bz2) --one-top-level=build-minimal + cd build-minimal + + ../configure \ + --prefix="$(pwd)/install" \ + --disable-shared \ + --disable-static \ + --disable-maintainer-mode \ + --disable-largefile \ + --disable-nls \ + --disable-rpath \ + --disable-charset \ + --disable-mclib \ + --disable-assert \ + --disable-aspell \ + --disable-background \ + --disable-vfs \ + --disable-doxygen-doc \ + --without-x \ + --without-gpm-mouse \ + --without-internal-edit \ + --without-diff-viewer \ + --without-subshell \ + --enable-tests \ + --enable-werror + + make -j$(nproc) + make check + + - uses: actions/upload-artifact@v4 + if: failure() + with: + name: test-suite-logs-ubuntu + path: build-*/**/test-suite.log + diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..f0f5bc15e0 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,34 @@ +name: CI +on: [ push, pull_request ] + +jobs: + call-build-ubuntu: + if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository + uses: ./.github/workflows/ci-ubuntu.yml + + call-build-fedora: + if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository + uses: ./.github/workflows/ci-fedora.yml + + call-build-alpine: + if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository + uses: ./.github/workflows/ci-alpine.yml + + call-build-macos: + if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository + uses: ./.github/workflows/ci-macos.yml + with: + # https://github.com/llvm/llvm-project/issues/20574 + CFLAGS: -Wno-assign-enum + + call-build-solaris: + if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository + uses: ./.github/workflows/ci-solaris.yml + + call-build-freebsd: + if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository + uses: ./.github/workflows/ci-freebsd.yml + with: + # https://github.com/llvm/llvm-project/issues/20574 + # https://github.com/GNUAspell/aspell/pull/651 + CFLAGS: -Wno-assign-enum -Wno-strict-prototypes From 73ef95df41b55c62b1d88f5c4a3e5da9533766aa Mon Sep 17 00:00:00 2001 From: "Yury V. Zaytsev" Date: Sat, 26 Oct 2024 18:22:17 +0200 Subject: [PATCH 2/9] maint: fix documentation linting script and add to CI Signed-off-by: Yury V. Zaytsev --- .github/workflows/ci-fedora.yml | 6 +++- maint/utils/doctest | 54 ++++++++++----------------------- 2 files changed, 21 insertions(+), 39 deletions(-) diff --git a/.github/workflows/ci-fedora.yml b/.github/workflows/ci-fedora.yml index 1db5b5b93a..142375179a 100644 --- a/.github/workflows/ci-fedora.yml +++ b/.github/workflows/ci-fedora.yml @@ -15,12 +15,16 @@ jobs: - name: Install dependencies run: | - dnf install -y autoconf automake gcc gettext-devel libtool make pkgconfig + dnf install -y autoconf automake gcc gettext-devel groff libtool make pkgconfig dnf install -y aspell-devel check-devel gpm-devel libX11-devel "pkgconfig(ext2fs)" "pkgconfig(glib-2.0)" "pkgconfig(gmodule-2.0)" "pkgconfig(libssh2)" "pkgconfig(slang)" # For tests dnf install -y glibc-gconv-extra util-linux + - name: Lint documentation + working-directory: maint + run: ./doctest + - name: Bootstrap build system run: ./autogen.sh diff --git a/maint/utils/doctest b/maint/utils/doctest index 5ed5311e0c..addad131f4 100755 --- a/maint/utils/doctest +++ b/maint/utils/doctest @@ -25,52 +25,30 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -#set -e +set +e -MC_SOURCE_ROOT_DIR=${MC_SOURCE_ROOT_DIR:-$(dirname $(dirname $(pwd)))} - -#*** include section (source functions, for example) ******************* - -#*** file scope functions ********************************************** - -one_test() { - "$@" >/dev/null 2>doctest.err - if test -s doctest.err; then - echo "ERROR messages follow:" 2>&1 - cat doctest.err 2>&1 - echo "ERROR while running following command:" 2>&1 - echo "$@" 2>&1 - echo "ERROR messages are preserved in doctest.err" - exit 1 - fi -} +MC_SOURCE_ROOT_DIR=${MC_SOURCE_ROOT_DIR:-$(dirname "$(pwd)")} #*** main code ********************************************************* [ -r "${MC_SOURCE_ROOT_DIR}/doc/man/mc.1.in" ] || { - echo "ERROR: cannot read doc/mc.1.in" 2>&1 + echo "ERROR: cannot read doc/man/mc.1.in" 2>&1 exit 1 } -# Test the documentation for possible errors. -for i in $(find "${MC_SOURCE_ROOT_DIR}/doc" -name '*.[1-9].in'); do - echo "test (groff): $i" - - preconv -e UTF8 "${i}" | \ - groff -wall -mandoc -Tutf8 | \ - grep "warning:" +for cmd in groff nroff ; do + IFS='' ROFF_WARNINGS="$ROFF_WARNINGS +$( + find "${MC_SOURCE_ROOT_DIR}/doc" -name '*.[1-9].in' \ + -exec sh -c "$cmd -K UTF-8 -Tutf8 -mandoc -ww '{}' | grep 'warning:'" \; 2>&1 +)" done -for i in $(find "${MC_SOURCE_ROOT_DIR}/doc" -name '*.[1-9].in'); do - echo "test (nroff): $i" +# Check that English manuals are in ASCII +ASCII_WARNINGS=$(find "${MC_SOURCE_ROOT_DIR}/doc" -maxdepth 1 -name '*.[1-9].in' -exec groff -Tascii -ww {} \; 2>&1) - preconv -e UTF8 "${i}" | \ - nroff -Tutf8 -mandoc | \ - grep "warning:" -done - -# Check the English manuals to be in ASCII. -one_test find "${MC_SOURCE_ROOT_DIR}/doc" -maxdepth 1 -name '*.[1-9].in' -exec groff -wall -Tascii {} \; - -rm -rf doctest.err -exit 0 +if [ "x`printf '%s' "${ROFF_WARNINGS}${ASCII_WARNINGS}" | tr -d "$IFS"`" != x ] ; then + echo "$ROFF_WARNINGS" | sort -u | grep . + echo "$ASCII_WARNINGS" | sort -u | grep . + exit 1 +fi From a018086f48a8b392cf6e527705ca69c912f97841 Mon Sep 17 00:00:00 2001 From: "Yury V. Zaytsev" Date: Sat, 26 Oct 2024 18:22:29 +0200 Subject: [PATCH 3/9] maint: remove obsolete CI/maint and re-implement source index Signed-off-by: Yury V. Zaytsev --- .github/workflows/update-sources.yml | 48 +++++ .travis.yml | 31 --- {maint/docs => doc}/RELEASE_PROCEDURE | 0 maint/docs/COMMIT_PROCEDURE | 4 - maint/docs/README | 7 - maint/docs/systems.txt | 9 - maint/{utils => }/doctest | 0 .../find-dup-includes/exclude-list.cfg | 0 .../find-dup-includes/find-in-one-file.pl | 0 maint/{utils => }/find-dup-includes/runme.sh | 6 +- maint/htagsfix | 180 ++++++++++++++++++ maint/{utils => }/sync-transifex/.gitignore | 0 maint/{utils => }/sync-transifex/README.md | 0 .../sync-transifex/config.d/mc.hint/po4a.cfg | 0 .../sync-transifex/config.d/mc.hint/tx.config | 0 .../sync-transifex/config.d/mc.pot/tx.config | 0 .../sync-transifex/hints-from-transifex.py | 0 .../sync-transifex/hints-to-transifex.py | 0 .../sync-transifex/po-from-transifex.py | 0 .../sync-transifex/po-to-transifex.py | 0 .../sync-transifex/translation_utils.py | 0 maint/{utils => }/unrefglobals.pl | 0 maint/{utils => }/update-years.sh | 0 maint/utils/check-indent.sh | 47 ----- maint/utils/deploy-key.enc | Bin 1680 -> 0 bytes maint/utils/deploy-key.pub | 1 - maint/utils/travis-build.sh | 105 ---------- maint/utils/travis-deploy.sh | 71 ------- 28 files changed, 231 insertions(+), 278 deletions(-) create mode 100644 .github/workflows/update-sources.yml delete mode 100644 .travis.yml rename {maint/docs => doc}/RELEASE_PROCEDURE (100%) delete mode 100644 maint/docs/COMMIT_PROCEDURE delete mode 100644 maint/docs/README delete mode 100644 maint/docs/systems.txt rename maint/{utils => }/doctest (100%) rename maint/{utils => }/find-dup-includes/exclude-list.cfg (100%) rename maint/{utils => }/find-dup-includes/find-in-one-file.pl (100%) rename maint/{utils => }/find-dup-includes/runme.sh (86%) create mode 100755 maint/htagsfix rename maint/{utils => }/sync-transifex/.gitignore (100%) rename maint/{utils => }/sync-transifex/README.md (100%) rename maint/{utils => }/sync-transifex/config.d/mc.hint/po4a.cfg (100%) rename maint/{utils => }/sync-transifex/config.d/mc.hint/tx.config (100%) rename maint/{utils => }/sync-transifex/config.d/mc.pot/tx.config (100%) rename maint/{utils => }/sync-transifex/hints-from-transifex.py (100%) rename maint/{utils => }/sync-transifex/hints-to-transifex.py (100%) rename maint/{utils => }/sync-transifex/po-from-transifex.py (100%) rename maint/{utils => }/sync-transifex/po-to-transifex.py (100%) rename maint/{utils => }/sync-transifex/translation_utils.py (100%) rename maint/{utils => }/unrefglobals.pl (100%) rename maint/{utils => }/update-years.sh (100%) delete mode 100755 maint/utils/check-indent.sh delete mode 100644 maint/utils/deploy-key.enc delete mode 100644 maint/utils/deploy-key.pub delete mode 100755 maint/utils/travis-build.sh delete mode 100755 maint/utils/travis-deploy.sh diff --git a/.github/workflows/update-sources.yml b/.github/workflows/update-sources.yml new file mode 100644 index 0000000000..a5ec277feb --- /dev/null +++ b/.github/workflows/update-sources.yml @@ -0,0 +1,48 @@ +name: update-sources + +on: + push: + branches: + - master + +jobs: + update-sources: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install GNU Global + run: sudo apt-get install -y global exuberant-ctags python3-pygments + + - name: Checkout source repo + uses: actions/checkout@v4 + with: + repository: MidnightCommander/source + path: HTML + ref: gh-pages + ssh-key: ${{ secrets.SOURCE_DEPLOY_KEY }} + + - name: Create sources index + run: | + pushd HTML + git rm -rf * + popd + + gtags + htags --suggest -t "Welcome to the Midnight Commander source tour!" + ./maint/htagsfix + + - name: Deploy to GitHub + run: | + cd HTML + + touch .nojekyll + echo "source.midnight-commander.org" > CNAME + + git config user.name "GitHub Actions" + git config user.email "github@midnight-commander.org" + + git add . + git commit -m "Deploy to GitHub Pages" + + git push --force-with-lease diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 701d3f471b..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,31 +0,0 @@ -language: c -sudo: true - -env: - - CFLAGS=-Wno-error=shadow - -install: - - sudo apt-get update -qq - - sudo apt-get install -y autoconf gettext autopoint libtool check indent - - sudo apt-get install -y e2fslibs-dev libaspell-dev libglib2.0-dev libgpm-dev libncurses5-dev libslang2-dev libssh2-1-dev libx11-dev unzip - - sudo apt-get install -y wget exuberant-ctags python-pygments ruby - -before_script: - - git fetch --tags - -script: - - ./maint/utils/check-indent.sh - - ./autogen.sh - - ./maint/utils/travis-build.sh - -after_success: - - openssl aes-256-cbc -K $encrypted_036881b9e9dd_key -iv $encrypted_036881b9e9dd_iv -in ./maint/utils/deploy-key.enc -out $HOME/.ssh/deploy-key -d - - chmod 600 $HOME/.ssh/deploy-key - - echo "Host github.com" >> $HOME/.ssh/config - - echo " IdentityFile ~/.ssh/deploy-key" >> $HOME/.ssh/config - -deploy: - provider: script - script: ./maint/utils/travis-deploy.sh - on: - branch: master diff --git a/maint/docs/RELEASE_PROCEDURE b/doc/RELEASE_PROCEDURE similarity index 100% rename from maint/docs/RELEASE_PROCEDURE rename to doc/RELEASE_PROCEDURE diff --git a/maint/docs/COMMIT_PROCEDURE b/maint/docs/COMMIT_PROCEDURE deleted file mode 100644 index aff68d76db..0000000000 --- a/maint/docs/COMMIT_PROCEDURE +++ /dev/null @@ -1,4 +0,0 @@ -Please run the following command: -make indent -in the build root directory before each new commit. - diff --git a/maint/docs/README b/maint/docs/README deleted file mode 100644 index 2e6e7fe414..0000000000 --- a/maint/docs/README +++ /dev/null @@ -1,7 +0,0 @@ -This directory contains files used to maintain the project. -It should not be included into any releases or even snapshots. - -Please run periodically the following command: -make cppcheck -in the build root directory. Fix as possible all code analysis -issues which found by the command. diff --git a/maint/docs/systems.txt b/maint/docs/systems.txt deleted file mode 100644 index ca5d7a40cb..0000000000 --- a/maint/docs/systems.txt +++ /dev/null @@ -1,9 +0,0 @@ -This is a list of system configurations that we test the Midnight -Commander on. Feel free to add your own entries. To get your system -identification, run config.guess from the config subdirectory. - -i386-unknown-freebsd4.11 Roland Illig -i386-unknown-netbsdelf1.6.2 Roland Illig -i686-pc-linux-gnu (SuSE 7.2) Roland Illig -powerpc-ibm-aix4.3.3.0 Roland Illig -sparc-sun-solaris2.8 Roland Illig diff --git a/maint/utils/doctest b/maint/doctest similarity index 100% rename from maint/utils/doctest rename to maint/doctest diff --git a/maint/utils/find-dup-includes/exclude-list.cfg b/maint/find-dup-includes/exclude-list.cfg similarity index 100% rename from maint/utils/find-dup-includes/exclude-list.cfg rename to maint/find-dup-includes/exclude-list.cfg diff --git a/maint/utils/find-dup-includes/find-in-one-file.pl b/maint/find-dup-includes/find-in-one-file.pl similarity index 100% rename from maint/utils/find-dup-includes/find-in-one-file.pl rename to maint/find-dup-includes/find-in-one-file.pl diff --git a/maint/utils/find-dup-includes/runme.sh b/maint/find-dup-includes/runme.sh similarity index 86% rename from maint/utils/find-dup-includes/runme.sh rename to maint/find-dup-includes/runme.sh index 040e8586da..4084bcb099 100755 --- a/maint/utils/find-dup-includes/runme.sh +++ b/maint/find-dup-includes/runme.sh @@ -27,7 +27,7 @@ set -e # You should have received a copy of the GNU General Public License # along with this program. If not, see . -MC_SOURCE_ROOT_DIR=${MC_SOURCE_ROOT_DIR:-$(dirname $(dirname $(dirname $(pwd))))} +MC_SOURCE_ROOT_DIR=${MC_SOURCE_ROOT_DIR:-$(dirname "$(dirname "$(pwd)")")} #*** include section (source functions, for example) ******************* @@ -38,8 +38,8 @@ findIncludeDupsInDir() { for i in $(find "${dir_name}" -name '*.[ch]'); do file_name=$(echo $i | ${SED-sed} 's@'"${MC_SOURCE_ROOT_DIR}/"'@@g') - [ $(grep "^\s*${file_name}$" -c "${MC_SOURCE_ROOT_DIR}/maint/utils/find-dup-includes/exclude-list.cfg") -ne 0 ] && continue - "${MC_SOURCE_ROOT_DIR}/maint/utils/find-dup-includes/find-in-one-file.pl" "${i}" + [ $(grep "^\s*${file_name}$" -c "${MC_SOURCE_ROOT_DIR}/maint/find-dup-includes/exclude-list.cfg") -ne 0 ] && continue + "${MC_SOURCE_ROOT_DIR}/maint/find-dup-includes/find-in-one-file.pl" "${i}" done } diff --git a/maint/htagsfix b/maint/htagsfix new file mode 100755 index 0000000000..c0db95e204 --- /dev/null +++ b/maint/htagsfix @@ -0,0 +1,180 @@ +#!/usr/bin/env ruby + +# +# Fixes htags' output so that files have fixed names. E.g., S/542.html -> D/whatever.c.h. +# +# It addresses the following problem: +# +# "Can htags create permanent addresses?" +# http://lists.gnu.org/archive/html/help-global/2015-11/msg00002.html +# + +require 'fileutils' +require 'pp' + +Encoding.default_external = "BINARY" + +$base = '.' # Where the HTML is stored. +$verbose = false +$debug = false +$create_subdirs = false # Experimental feature. Doesn't really work. + +# Bonus: highlight the target line. +$css = " +a:target { + position: absolute; + left: 0; + height: 1.35em; + width: 100%; + background: yellow; + opacity: .5; + z-index: -1000; +} +" + +# +# Computes pretty names for files: +# +# '.../S/456.html' => 'S/modules/tty.c.html' +# +def prettyname(full_path, prefix, kind, nid, ext) + gist = nid + start = IO.read(full_path, 1024) + if start =~ /(.*?)<\/title>/ then + gist = $1 + gist.gsub!(%r{/+$}, '') # remove trailing '/'s. + if not $create_subdirs then + gist.gsub!('/', '--') + end + gist.gsub!(%r{[^a-zA-Z0-9_.,/-]}, '-') # clean special characters. + end + return kind + '/' + gist + ext +end + +class Counter + class << self + def init(total) + @total = total + end + def reset() + @count = 0 + end + def report() + print "[#{@count}/#{@total}]\r" + @count += 1 + end + def finish() + puts + end + end +end + +# +# Returns a table explaining how to rename the files. E.g.: +# +# { +# 'S/456.html' => 'S/modules/tty.c.html' +# ... +# } +# +def build_cnv_tbl() + Counter.reset() + cnv = {} + Dir[$base + '/{[A-Z],files}/*.html'].each do |full_path| + #p full_path + if full_path =~ /(.*)\/((\w+)\/(\d+)(\.\w+))$/ then + prefix = $1 # "/home/joe/.../HTML" + path = $2 # "S/323.html" + kind = $3 # "S" + nid = $4 # "323" + ext = $5 # ".html" + pretty = prettyname(full_path, prefix, kind, nid, ext) + cnv[path] = pretty + end + Counter.report() + end + Counter.finish() + return cnv +end + +# +# Make all the substiutions inside the files: +# +# <a href='../S/456.html'> --> <a href='../S/modules/tty.c.html'> +# ... +# +def mksub(cnv) + Counter.reset() + Dir[$base + '/**/*.html'].each do |path| + kind = path[$base.length .. -1][/\w+/] + text = IO.read(path) + fixed = text.gsub(/(<a href='(?:..\/)?)([^'#]+)/) do |a| + prefix = $1 + target = $2 + if cnv[target] then + target = cnv[target] + elsif cnv[kind + '/' + target] then + # This is a relative link of the form: href='456.html' + if cnv[kind + '/' + target].match /\/(.*)/ # converts "s/whatever.html" to "whatever.html" + target = $1 + end + end + prefix + target + end + + # Fix a problem in Opera, where empty lines are squashed. + fixed.gsub!(%r{(<a id='L\d+' name='L\d+'></a>)\n}, "\\1 \n") + + if text != fixed then + IO.write(path, fixed) + puts(path + " modified") if $debug + end + Counter.report() + end + Counter.finish() +end + +# +# Rename the files. +# +def rename(cnv) + Counter.reset() + cnv.each do |a, b| + src = $base + '/' + a + trg = $base + '/' + b + if $create_subdirs then + FileUtils.mkdir_p(File.dirname(trg)) + end + File.rename(src, trg) + Counter.report() + end + Counter.finish() +end + +def better_css(css_path) + text = IO.read(css_path) + IO.write(css_path, text + $css) +end + +def main() + if not File.exists?($base + '/help.html') then + $base += '/HTML' + if not File.exists?($base + '/help.html') then + puts "Error: This doesn't look like htags' output directory." + exit(1) + end + end + Counter.init( Dir[$base + '/**/*.html'].length ) + puts "Figuring out pretty names..." + cnv = build_cnv_tbl() + pp cnv if $verbose + puts "Updating links in files..." + mksub(cnv) + puts "Renaming files..." + rename(cnv) + puts "Enhancing the css..." + better_css($base + '/style.css') + puts "Done." +end + +main() diff --git a/maint/utils/sync-transifex/.gitignore b/maint/sync-transifex/.gitignore similarity index 100% rename from maint/utils/sync-transifex/.gitignore rename to maint/sync-transifex/.gitignore diff --git a/maint/utils/sync-transifex/README.md b/maint/sync-transifex/README.md similarity index 100% rename from maint/utils/sync-transifex/README.md rename to maint/sync-transifex/README.md diff --git a/maint/utils/sync-transifex/config.d/mc.hint/po4a.cfg b/maint/sync-transifex/config.d/mc.hint/po4a.cfg similarity index 100% rename from maint/utils/sync-transifex/config.d/mc.hint/po4a.cfg rename to maint/sync-transifex/config.d/mc.hint/po4a.cfg diff --git a/maint/utils/sync-transifex/config.d/mc.hint/tx.config b/maint/sync-transifex/config.d/mc.hint/tx.config similarity index 100% rename from maint/utils/sync-transifex/config.d/mc.hint/tx.config rename to maint/sync-transifex/config.d/mc.hint/tx.config diff --git a/maint/utils/sync-transifex/config.d/mc.pot/tx.config b/maint/sync-transifex/config.d/mc.pot/tx.config similarity index 100% rename from maint/utils/sync-transifex/config.d/mc.pot/tx.config rename to maint/sync-transifex/config.d/mc.pot/tx.config diff --git a/maint/utils/sync-transifex/hints-from-transifex.py b/maint/sync-transifex/hints-from-transifex.py similarity index 100% rename from maint/utils/sync-transifex/hints-from-transifex.py rename to maint/sync-transifex/hints-from-transifex.py diff --git a/maint/utils/sync-transifex/hints-to-transifex.py b/maint/sync-transifex/hints-to-transifex.py similarity index 100% rename from maint/utils/sync-transifex/hints-to-transifex.py rename to maint/sync-transifex/hints-to-transifex.py diff --git a/maint/utils/sync-transifex/po-from-transifex.py b/maint/sync-transifex/po-from-transifex.py similarity index 100% rename from maint/utils/sync-transifex/po-from-transifex.py rename to maint/sync-transifex/po-from-transifex.py diff --git a/maint/utils/sync-transifex/po-to-transifex.py b/maint/sync-transifex/po-to-transifex.py similarity index 100% rename from maint/utils/sync-transifex/po-to-transifex.py rename to maint/sync-transifex/po-to-transifex.py diff --git a/maint/utils/sync-transifex/translation_utils.py b/maint/sync-transifex/translation_utils.py similarity index 100% rename from maint/utils/sync-transifex/translation_utils.py rename to maint/sync-transifex/translation_utils.py diff --git a/maint/utils/unrefglobals.pl b/maint/unrefglobals.pl similarity index 100% rename from maint/utils/unrefglobals.pl rename to maint/unrefglobals.pl diff --git a/maint/utils/update-years.sh b/maint/update-years.sh similarity index 100% rename from maint/utils/update-years.sh rename to maint/update-years.sh diff --git a/maint/utils/check-indent.sh b/maint/utils/check-indent.sh deleted file mode 100755 index daa612ad32..0000000000 --- a/maint/utils/check-indent.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash -# -# Midnight Commander - check source code indentation -# -# Copyright (C) 2015 -# The Free Software Foundation, Inc. -# -# Written by: -# Slava Zanko <slavazanko@gmail.com>, 2015 -# -# This file is part of the Midnight Commander. -# -# The Midnight Commander is free software: you can redistribute it -# and/or modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation, either version 3 of the License, -# or (at your option) any later version. -# -# The Midnight Commander is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -set -e -set -x - -findUnindentedFiles() { - local directory=$1 - find "${directory}" -name '*.[ch]' -print0 | \ - xargs -0 indent \ - --gnu-style \ - --format-first-column-comments \ - --indent-level4 \ - --brace-indent0 \ - --line-length100 \ - --no-tabs \ - --blank-lines-after-procedures - return $(git ls-files --modified | wc -l) -} - -( findUnindentedFiles "lib" && findUnindentedFiles "src" && findUnindentedFiles "tests" ) || { - echo "Sources not indented" - git ls-files --modified - exit 1 -} diff --git a/maint/utils/deploy-key.enc b/maint/utils/deploy-key.enc deleted file mode 100644 index 38f2c030942f3020b9deaa4924660e4a4b566e5a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1680 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 ak&(ZDhDMpmuSTK_6~=IS{}x?XrWha&&^h=3 diff --git a/maint/utils/deploy-key.pub b/maint/utils/deploy-key.pub deleted file mode 100644 index 07d77f9bf9..0000000000 --- a/maint/utils/deploy-key.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDOpXSX8KMkqFPoXx4H+q0b9/taVceIoQu2QQQqqA/5MvlM0XD/YTBP2Nba235R+WSnC0F887+96xK7kx/48JrQeW5n+tle4Ot0NNfN0ON6pzhktshTk1YQUQfs5NDSXhBFXynTM9VgmXfFGxmG3nx+ym+hhN57IHnbwAQT5rk1cetaZNjoTVhEbVSzKJgqTQk1hUqRUuNFePPrXaMaqiWhaRl1gPYWQeNlqykT9p5tKgzbhO4lmwIGj+AUHOatTcp2qbgUElcUQuwd5Wt2CwvsM/8Pb1BUHHEl93qxERe4Nhxq98QOlqIoZa5gznIfw5iPXRpB9t5ijVL5qadWoNjn travis@midnight-commander.org diff --git a/maint/utils/travis-build.sh b/maint/utils/travis-build.sh deleted file mode 100755 index 92c5f9b75e..0000000000 --- a/maint/utils/travis-build.sh +++ /dev/null @@ -1,105 +0,0 @@ -#!/bin/bash -# -# Midnight Commander - build and test common configurations -# -# Copyright (C) 2015 -# The Free Software Foundation, Inc. -# -# Written by: -# Slava Zanko <slavazanko@gmail.com>, 2015 -# Yury V. Zaytsev <yury@shurup.com>, 2015 -# -# This file is part of the Midnight Commander. -# -# The Midnight Commander is free software: you can redistribute it -# and/or modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation, either version 3 of the License, -# or (at your option) any later version. -# -# The Midnight Commander is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -set -e -set -x - -function do_build() { - make - make -k check - make install -} - -# Build distribution archive -mkdir -p distrib && cd $_ - -../configure -make dist-bzip2 - -DISTFILE=$(ls mc-*.tar.bz2) -DISTDIR=$(basename "$DISTFILE" .tar.bz2) - -tar -xjf $DISTFILE -cd $DISTDIR - -# Build default configuration (S-Lang) -mkdir -p build-default && pushd $_ - -../configure \ - --prefix="$(pwd)/INSTALL_ROOT" \ - --with-screen=slang \ - --enable-maintainer-mode \ - --enable-mclib \ - --enable-charset \ - --enable-aspell \ - --enable-tests \ - --enable-werror - -do_build - -popd - -# Build default configuration (ncurses) -mkdir -p build-ncurses && pushd $_ - -../configure \ - --prefix="$(pwd)/INSTALL_ROOT" \ - --with-screen=ncurses \ - --enable-maintainer-mode \ - --enable-mclib \ - --enable-charset \ - --enable-aspell \ - --enable-tests \ - --enable-werror - -do_build - -popd - -# Build all disabled -mkdir -p build-all-disabled && pushd $_ - -../configure \ - --prefix="$(pwd)/INSTALL_ROOT" \ - --disable-maintainer-mode \ - --disable-mclib \ - --disable-charset \ - --disable-aspell \ - --disable-largefile \ - --disable-nls \ - --disable-vfs \ - --disable-background \ - --without-x \ - --without-gpm-mouse \ - --without-internal-edit \ - --without-diff-viewer \ - --without-subshell \ - --enable-tests \ - --enable-werror - -do_build - -popd diff --git a/maint/utils/travis-deploy.sh b/maint/utils/travis-deploy.sh deleted file mode 100755 index 0c0c9742c5..0000000000 --- a/maint/utils/travis-deploy.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash -# -# Midnight Commander - deployment script for Travis CI -# -# Copyright (C) 2016 -# The Free Software Foundation, Inc. -# -# Written by: -# Yury V. Zaytsev <yury@shurup.com>, 2016 -# -# This file is part of the Midnight Commander. -# -# The Midnight Commander is free software: you can redistribute it -# and/or modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation, either version 3 of the License, -# or (at your option) any later version. -# -# The Midnight Commander is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -set -e -set -x - -GLOBAL_VERSION="6.5.7" -GLOBAL_URL="http://ftp.gnu.org/pub/gnu/global/global-${GLOBAL_VERSION}.tar.gz" -HTAGSFIX_URL="https://github.com/mooffie/htagsfix/raw/master/htagsfix" - -mkdir .global && pushd .global # ignored by GLOBAL's indexer - - wget ${GLOBAL_URL} - tar zxvf global-${GLOBAL_VERSION}.tar.gz > /dev/null 2>&1 - - pushd global-${GLOBAL_VERSION} - ./configure --prefix=$(pwd)/install > /dev/null 2>&1 - make > /dev/null 2>&1 - make install > /dev/null 2>&1 - popd - - export PATH="$(pwd)/global-${GLOBAL_VERSION}/install/bin:$PATH" - -popd - -gtags -v > /dev/null 2>&1 - -htags --suggest -t "Welcome to the Midnight Commander source tour!" > /dev/null 2>&1 - -wget --no-check-certificate ${HTAGSFIX_URL} - -ruby htagsfix > /dev/null 2>&1 - -cd HTML - -touch .nojekyll -echo "source.midnight-commander.org" > CNAME - -git init - -git config user.name "Travis CI" -git config user.email "travis@midnight-commander.org" - -git add . > /dev/null 2>&1 -git commit -m "Deploy to GitHub Pages" > /dev/null 2>&1 - -git push --force --quiet git@github.com:MidnightCommander/source.git master:gh-pages > /dev/null 2>&1 - -exit 0 From 289b9c85bed43f0198935d5a08b5a18004be8bc9 Mon Sep 17 00:00:00 2001 From: "Yury V. Zaytsev" <yury@shurup.com> Date: Sat, 19 Oct 2024 09:35:19 +0200 Subject: [PATCH 4/9] (canonicalize_pathname_custom): fix `--disable-charset` build broken in 8f723b8 Signed-off-by: Yury V. Zaytsev <yury@shurup.com> --- lib/utilunix.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/utilunix.c b/lib/utilunix.c index 4821f2dff3..6e53687477 100644 --- a/lib/utilunix.c +++ b/lib/utilunix.c @@ -1040,7 +1040,9 @@ canonicalize_pathname_custom (char *path, canon_path_flags_t flags) #endif /* HAVE_CHARSET */ else { +#ifdef HAVE_CHARSET last: +#endif /* HAVE_CHARSET */ if (s >= lpath + url_delim_len && strncmp (s - url_delim_len, VFS_PATH_URL_DELIMITER, url_delim_len) == 0) *s = '\0'; From 577b253ab315fa90c0543b22faf009ac042e18ca Mon Sep 17 00:00:00 2001 From: "Yury V. Zaytsev" <yury@shurup.com> Date: Sun, 20 Oct 2024 12:59:41 +0200 Subject: [PATCH 5/9] buildsys: remove `-e` from grep for compatibility with non-XPG4 grep Signed-off-by: Yury V. Zaytsev <yury@shurup.com> --- autogen.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autogen.sh b/autogen.sh index 94d8e7c3f5..a37064c6a0 100755 --- a/autogen.sh +++ b/autogen.sh @@ -14,7 +14,7 @@ ${AUTORECONF:-autoreconf} --verbose --install --force -I m4 ${AUTORECONF_FLAGS} rm -f INSTALL && ln -s doc/INSTALL . # Generate po/POTFILES.in -if ! xgettext -h 2>&1 | grep -e '--keyword' >/dev/null ; then +if ! xgettext -h 2>&1 | grep -- '--keyword' >/dev/null ; then echo "gettext is unable to extract translations, set XGETTEXT to GNU gettext!" >&2 touch po/POTFILES.in else From 6881db8b1669b56dc23ce41c360e35fef4f95c97 Mon Sep 17 00:00:00 2001 From: "Yury V. Zaytsev" <yury@shurup.com> Date: Sun, 20 Oct 2024 13:49:24 +0200 Subject: [PATCH 6/9] posix: use `tail -1`, not `tail -n 1`, prefer `gsed` for Solaris compat Non-XPG4 version of `tail` fails if you call it as `tail -n 1`, but `tail -1` works everywhere and is portable. ``` % ssh solaris Last login: Sun Oct 20 12:20:56 2024 from 192.168.64.1 Oracle Solaris 11.4.42.111.0 Assembled December 2021 root@solaris:~# tail -n 1 .profile usage: tail [+/-[n][lbc][f]] [file] tail [+/-[n][l][r|f]] [file] root@solaris:~# tail -1 .profile root@solaris:~# head -n 1 .profile root@solaris:~# head -1 .profile root@solaris:~# /usr/xpg4/bin/tail -n 1 .profile ``` Signed-off-by: Yury V. Zaytsev <yury@shurup.com> --- src/vfs/extfs/helpers/changesetfs | 6 +++--- src/vfs/extfs/helpers/iso9660.in | 4 ++-- src/vfs/extfs/helpers/patchsetfs | 4 ++-- src/vfs/extfs/helpers/rpm | 4 +++- src/vfs/shell/shelldef.h | 2 +- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/vfs/extfs/helpers/changesetfs b/src/vfs/extfs/helpers/changesetfs index eebdf8c7c3..4c8eb7acbf 100755 --- a/src/vfs/extfs/helpers/changesetfs +++ b/src/vfs/extfs/helpers/changesetfs @@ -57,7 +57,7 @@ changesetfs_copyout_git() [ -z "$GIT_DIR" ] && GIT_DIR=$WORK_DIR filecommit=`git --git-dir="$GIT_DIR" show --raw --pretty=tformat:%h "$chset" -- "$fname"| \ - tail -n1 | \ + tail -1 | \ sed 's@^::[0-9]*\s*[0-9]*\s*[0-9]*\s*@@' | \ sed 's@^:[0-9]*\s*[0-9]*\s*@@' | \ cut -d'.' -f 1` @@ -98,8 +98,8 @@ command=$1; shift tmp_file=$1; shift WORK_DIR=`head -n1 $tmp_file` -fname=`tail -n2 $tmp_file | head -n1` -VCS_type=`tail -n1 $tmp_file` +fname=`tail -2 $tmp_file | head -n1` +VCS_type=`tail -1 $tmp_file` case "$command" in list) changesetfs_list "$VCS_type" "$WORK_DIR" "$fname" ;; diff --git a/src/vfs/extfs/helpers/iso9660.in b/src/vfs/extfs/helpers/iso9660.in index 078faa6746..e5d41dafe1 100644 --- a/src/vfs/extfs/helpers/iso9660.in +++ b/src/vfs/extfs/helpers/iso9660.in @@ -97,10 +97,10 @@ xorriso_list() ( fi # The first line is /, skip it - tail -n+2 "$temp_ls" | + sed 1,1d "$temp_ls" | # disk_ops.c:Xorriso_format_ls_l() prints the boot catalog file as of # type "e". Make it a generic file - sed -E 's,^e,-,' | + sed 's,^e,-,' | @AWK@ "$awk_xorriso_unesc" rm -f "$temp_ls" diff --git a/src/vfs/extfs/helpers/patchsetfs b/src/vfs/extfs/helpers/patchsetfs index 9bbe9f97d3..3096a49bb2 100755 --- a/src/vfs/extfs/helpers/patchsetfs +++ b/src/vfs/extfs/helpers/patchsetfs @@ -93,8 +93,8 @@ command=$1; shift tmp_file=$1; shift WORK_DIR=`head -n1 $tmp_file` -fname=`tail -n2 $tmp_file | head -n1` -VCS_type=`tail -n1 $tmp_file` +fname=`tail -2 $tmp_file | head -n1` +VCS_type=`tail -1 $tmp_file` case "$command" in list) patchsetfs_list "$VCS_type" "$WORK_DIR" "$fname" ;; diff --git a/src/vfs/extfs/helpers/rpm b/src/vfs/extfs/helpers/rpm index 47b2e6e730..20520bf416 100755 --- a/src/vfs/extfs/helpers/rpm +++ b/src/vfs/extfs/helpers/rpm @@ -69,7 +69,9 @@ fi RPM_QUERY_FMT="$RPM -qp --qf" RPM2CPIO="rpm2cpio" -SED="sed" +# Prefer `gsed` on Solaris due to complex regex +SED=`command -v gsed 2>/dev/null` \ + || SED=`command -v sed 2>/dev/null` param=$1; shift rpm_filename=$1; shift diff --git a/src/vfs/shell/shelldef.h b/src/vfs/shell/shelldef.h index 37244d9804..fd56462dad 100644 --- a/src/vfs/shell/shelldef.h +++ b/src/vfs/shell/shelldef.h @@ -192,7 +192,7 @@ "if `ls -Q / >/dev/null 2>&1` ; then\n" \ " res=`expr $res + 16`\n" \ "fi\n" \ -"dat=`ls -lan / 2>/dev/null | head -n 3 | tail -n 1 | (\n" \ +"dat=`ls -lan / 2>/dev/null | head -n 3 | tail -1 | (\n" \ " while read p l u g s rec; do\n" \ " if [ -n \"$g\" ]; then\n" \ " if [ -n \"$l\" ]; then\n" \ From 9985e2129b38f81acdcf75bf3ad68ac8570e9cc6 Mon Sep 17 00:00:00 2001 From: Kirill Rekhov <krekhov.dev@gmail.com> Date: Mon, 21 Oct 2024 00:09:57 +0300 Subject: [PATCH 7/9] doc: fix groff warning in mc.1.in (closes MidnightCommander/mc#207) Signed-off-by: Yury V. Zaytsev <yury@shurup.com> --- doc/man/ru/mc.1.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/man/ru/mc.1.in b/doc/man/ru/mc.1.in index 26cd295c13..d1b0b150c6 100644 --- a/doc/man/ru/mc.1.in +++ b/doc/man/ru/mc.1.in @@ -2343,8 +2343,8 @@ Commander, выделены цветом, определённым ключев тестироваться. Вы можете перемещать подсветку по названиям, используя клавишу .B Tab -или клавиши, применяемые в редакторе vi ('h' влево, 'j' вниз, 'k' вверх, -'l' вправо). Если один раз нажать на клавиши со стрелками, после чего возле +или клавиши, применяемые в редакторе vi ('h' влево, 'j' вниз, 'k' вверх, 'l' +вправо). Если один раз нажать на клавиши со стрелками, после чего возле их названий в таблице появится пометка .IR OK , то их тоже можно будет использовать для управления перемещением. From 58f75eeb2e0788c9b275f47b580e130d1b93fd8a Mon Sep 17 00:00:00 2001 From: "Yury V. Zaytsev" <yury@shurup.com> Date: Mon, 21 Oct 2024 10:47:37 +0200 Subject: [PATCH 8/9] doc: fix typo in ftp path - manual pages Signed-off-by: Yury V. Zaytsev <yury@shurup.com> --- doc/man/es/mc.1.in | 2 +- doc/man/hu/mc.1.in | 2 +- doc/man/it/mc.1.in | 2 +- doc/man/mc.1.in | 2 +- doc/man/pl/mc.1.in | 2 +- doc/man/ru/mc.1.in | 2 +- doc/man/sr/mc.1.in | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/man/es/mc.1.in b/doc/man/es/mc.1.in index a6b63bcd25..a1fdc2fc18 100644 --- a/doc/man/es/mc.1.in +++ b/doc/man/es/mc.1.in @@ -3076,7 +3076,7 @@ o simplemente emplear la orden como cuando cambiamos habitualmente de directorio, pero indicando como ruta: .PP -.I ftp://[!][usuario[:clave]@]maquina[:puerto][dir\-remoto] +.I ftp://[!][usuario[:clave]@]maquina[:puerto]/[dir\-remoto] .PP Los elementos .IR usuario , diff --git a/doc/man/hu/mc.1.in b/doc/man/hu/mc.1.in index 4c31daed61..8565256a70 100644 --- a/doc/man/hu/mc.1.in +++ b/doc/man/hu/mc.1.in @@ -2529,7 +2529,7 @@ panel FTP kapcsolat... parancsát (elérhető a menüből), vagy közvetlenül átválthatsz a jelenlegi könyvtárból a cd parancs használatával, valahogy így: .PP -.I ftp://[!][felhasználó[:jelszó]@]machine[:port][távoli\-könyvtár] +.I ftp://[!][felhasználó[:jelszó]@]machine[:port]/[távoli\-könyvtár] .PP A .I felhasználó, port diff --git a/doc/man/it/mc.1.in b/doc/man/it/mc.1.in index 3f6d72b1cc..c434d45ea4 100644 --- a/doc/man/it/mc.1.in +++ b/doc/man/it/mc.1.in @@ -2571,7 +2571,7 @@ la directory corrente con un comando .I cd verso un percorso simile al seguente: .PP -.I ftp://[!][utente[:pass]@]macchina[:porta][dir\-remota] +.I ftp://[!][utente[:pass]@]macchina[:porta]/[dir\-remota] .PP Gli elementi .IR utente , diff --git a/doc/man/mc.1.in b/doc/man/mc.1.in index fb32114711..51451517db 100644 --- a/doc/man/mc.1.in +++ b/doc/man/mc.1.in @@ -3166,7 +3166,7 @@ item in the menu or directly change your current directory using the .I cd command to a path name that looks like this: .PP -.I ftp://[!][user[:pass]@]machine[:port][remote\-dir] +.I ftp://[!][user[:pass]@]machine[:port]/[remote\-dir] .PP The .IR user , diff --git a/doc/man/pl/mc.1.in b/doc/man/pl/mc.1.in index 5de074ed5d..b163e06830 100644 --- a/doc/man/pl/mc.1.in +++ b/doc/man/pl/mc.1.in @@ -2178,7 +2178,7 @@ normalnego użytku, możesz próbować używać panelowych komend FTP i dowiąza (dostępnych z linii menu) lub zmienić ścieżkę bezpośrednio za pomocą zwykłej komendy cd wyglądającej tak jak poniżej: .PP -.I ftp://[!][użytkownik[:hasło]@]komputer[:port][zdalny katalog] +.I ftp://[!][użytkownik[:hasło]@]komputer[:port]/[zdalny\-katalog] .PP Parametry .IR użytkownik , diff --git a/doc/man/ru/mc.1.in b/doc/man/ru/mc.1.in index d1b0b150c6..0dab0ad17e 100644 --- a/doc/man/ru/mc.1.in +++ b/doc/man/ru/mc.1.in @@ -3613,7 +3613,7 @@ tar\-файлов; сменить текущий каталог командой cd, задав путь к каталогу следующим образом: .PP -.I ftp://[!][user[:pass]@]machine[:port][remote\-dir] +.I ftp://[!][user[:pass]@]machine[:port]/[remote\-dir] .PP Элементы .IR user , diff --git a/doc/man/sr/mc.1.in b/doc/man/sr/mc.1.in index c285adcc97..4c78135009 100644 --- a/doc/man/sr/mc.1.in +++ b/doc/man/sr/mc.1.in @@ -2552,7 +2552,7 @@ if the .I cd (пром.дир.) на путању која изгледа овако: .PP -.I ftp://[!][корисник[:лозинка]@]машина[:порт][удаљени\-дир] +.I ftp://[!][корисник[:лозинка]@]машина[:порт]/[удаљени\-дир] .PP Елементи .IR корисник , From 61909fa24e62c623959d33a5934a6853a9decd4a Mon Sep 17 00:00:00 2001 From: "Yury V. Zaytsev" <yury@shurup.com> Date: Sat, 26 Oct 2024 18:06:58 +0200 Subject: [PATCH 9/9] mountlist: suppress unused label warning on FreeBSD Signed-off-by: Yury V. Zaytsev <yury@shurup.com> --- configure.ac | 1 + lib/global.h | 6 ++++++ src/filemanager/mountlist.c | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 0934a45483..d598b95cb4 100644 --- a/configure.ac +++ b/configure.ac @@ -66,6 +66,7 @@ ax_gcc_func_attribute_save_flags=$[]_AC_LANG_PREFIX[]FLAGS _AC_LANG_PREFIX[]FLAGS= AX_GCC_FUNC_ATTRIBUTE([fallthrough]) AX_GCC_FUNC_ATTRIBUTE([weak]) +AX_GCC_FUNC_ATTRIBUTE([unused]) _AC_LANG_PREFIX[]FLAGS=$ax_gcc_func_attribute_save_flags unset ax_gcc_func_attribute_save_flags diff --git a/lib/global.h b/lib/global.h index 65454d15c5..a09607eb2a 100644 --- a/lib/global.h +++ b/lib/global.h @@ -50,6 +50,12 @@ #define MC_FALLTHROUGH #endif +#ifdef HAVE_FUNC_ATTRIBUTE_UNUSED +#define MC_UNUSED __attribute__((unused)) +#else +#define MC_UNUSED +#endif + #ifdef USE_MAINTAINER_MODE #include "lib/logging.h" #endif diff --git a/src/filemanager/mountlist.c b/src/filemanager/mountlist.c index bab6aa1f73..4cfad4dce8 100644 --- a/src/filemanager/mountlist.c +++ b/src/filemanager/mountlist.c @@ -1215,7 +1215,7 @@ read_file_system_list (void) return g_slist_reverse (mount_list); - free_then_fail: + free_then_fail: MC_UNUSED; { int saved_errno = errno;