Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package clipman for openSUSE:Factory checked in at 2025-11-03 18:55:17 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/clipman (Old) and /work/SRC/openSUSE:Factory/.clipman.new.1980 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "clipman" Mon Nov 3 18:55:17 2025 rev:5 rq:1315259 version:1.6.5 Changes: -------- --- /work/SRC/openSUSE:Factory/clipman/clipman.changes 2024-05-03 19:44:30.936776871 +0200 +++ /work/SRC/openSUSE:Factory/.clipman.new.1980/clipman.changes 2025-11-03 18:55:39.082937363 +0100 @@ -1,0 +2,12 @@ +Sat Nov 01 09:50:50 UTC 2025 - Andrea Manzini <[email protected]> + +- Update to version 1.6.5: + * Update dependencies + * Update minimum Go version to 1.14 + * Add some tests for preprocessData + * Add Unicode NFC normalization flag + * restore show-history (#3) + +- added %check section to run unit tests + +------------------------------------------------------------------- Old: ---- clipman-1.6.4.tar.zst New: ---- clipman-1.6.5.tar.zst ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ clipman.spec ++++++ --- /var/tmp/diff_new_pack.JI8EsF/_old 2025-11-03 18:55:40.743006613 +0100 +++ /var/tmp/diff_new_pack.JI8EsF/_new 2025-11-03 18:55:40.747006780 +0100 @@ -1,7 +1,7 @@ # # spec file for package clipman # -# Copyright (c) 2024 SUSE LLC +# Copyright (c) 2025 SUSE LLC and contributors # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: clipman -Version: 1.6.4 +Version: 1.6.5 Release: 0 Summary: A clipboard manager for Wayland License: GPL-3.0-only @@ -26,7 +26,7 @@ # Run go build && go mod vendor to get vendor/ subdirectory Source1: vendor.tar.zst BuildRequires: zstd -BuildRequires: golang(API) >= 1.12 +BuildRequires: golang(API) >= 1.14 %description A clipboard manager for Wayland with support for @@ -45,6 +45,9 @@ export RPM_OPT_FLAGS="%{optflags}" go build -v -x -mod=vendor $BUILDMOD -a -ldflags "" +%check +go test ./... + %install install -Dm755 clipman %{buildroot}%{_bindir}/clipman install -Dm644 -t %{buildroot}%{_mandir}/man1/ docs/%{name}.* ++++++ _service ++++++ --- /var/tmp/diff_new_pack.JI8EsF/_old 2025-11-03 18:55:40.787008449 +0100 +++ /var/tmp/diff_new_pack.JI8EsF/_new 2025-11-03 18:55:40.791008615 +0100 @@ -3,7 +3,7 @@ <param name="url">https://github.com/chmouel/clipman</param> <param name="scm">git</param> <param name="exclude">.git</param> - <param name="revision">1.6.4</param> + <param name="revision">v1.6.5</param> <param name="versionformat">@PARENT_TAG@</param> <param name="changesgenerate">enable</param> <param name="versionrewrite-pattern">v(.*)</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.JI8EsF/_old 2025-11-03 18:55:40.815009617 +0100 +++ /var/tmp/diff_new_pack.JI8EsF/_new 2025-11-03 18:55:40.819009784 +0100 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/chmouel/clipman</param> - <param name="changesrevision">f3bc8930983ffc7ed60b4f383239397ccb505a5d</param></service></servicedata> + <param name="changesrevision">0fd6f12d9c234475c51f167eff426d737d0f6d05</param></service></servicedata> (No newline at EOF) ++++++ clipman-1.6.4.tar.zst -> clipman-1.6.5.tar.zst ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clipman-1.6.4/.github/workflows/go.yml new/clipman-1.6.5/.github/workflows/go.yml --- old/clipman-1.6.4/.github/workflows/go.yml 2024-04-19 12:16:37.000000000 +0200 +++ new/clipman-1.6.5/.github/workflows/go.yml 1970-01-01 01:00:00.000000000 +0100 @@ -1,28 +0,0 @@ -# This workflow will build a golang project -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go - -name: Go - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - -jobs: - - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version: '1.20' - - - name: Build - run: go build -v ./... - - - name: Test - run: go test -v ./... diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clipman-1.6.4/.github/workflows/golangci_lint.yaml new/clipman-1.6.5/.github/workflows/golangci_lint.yaml --- old/clipman-1.6.4/.github/workflows/golangci_lint.yaml 2024-04-19 12:16:37.000000000 +0200 +++ new/clipman-1.6.5/.github/workflows/golangci_lint.yaml 1970-01-01 01:00:00.000000000 +0100 @@ -1,53 +0,0 @@ -name: golangci-lint -on: - push: - branches: - - master - - main - pull_request: - -permissions: - contents: read - -jobs: - golangci: - name: lint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v4 - with: - go-version: '1.21' - cache: false - - name: golangci-lint - uses: golangci/golangci-lint-action@v3 - with: - # Require: The version of golangci-lint to use. - # When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version. - # When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit. - version: v1.54 - - # Optional: working directory, useful for monorepos - # working-directory: somedir - - # Optional: golangci-lint command line arguments. - # - # Note: By default, the `.golangci.yml` file should be at the root of the repository. - # The location of the configuration file can be changed by using `--config=` - # args: --timeout=30m --config=/my/path/.golangci.yml --issues-exit-code=0 - - # Optional: show only new issues if it's a pull request. The default value is `false`. - # only-new-issues: true - - # Optional: if set to true, then all caching functionality will be completely disabled, - # takes precedence over all other caching options. - # skip-cache: true - - # Optional: if set to true, then the action won't cache or restore ~/go/pkg. - # skip-pkg-cache: true - - # Optional: if set to true, then the action won't cache or restore ~/.cache/go-build. - # skip-build-cache: true - - # Optional: The mode to install golangci-lint. It can be 'binary' or 'goinstall'. - # install-mode: "goinstall" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clipman-1.6.4/.gitignore new/clipman-1.6.5/.gitignore --- old/clipman-1.6.4/.gitignore 2024-04-19 12:16:37.000000000 +0200 +++ new/clipman-1.6.5/.gitignore 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -bin/* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clipman-1.6.4/.golangci.yml new/clipman-1.6.5/.golangci.yml --- old/clipman-1.6.4/.golangci.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/clipman-1.6.5/.golangci.yml 2025-10-10 16:53:38.000000000 +0200 @@ -0,0 +1,108 @@ +linters-settings: + gocritic: + disabled-checks: + - unlambda + gofumpt: + extra-rules: true +linters: + enable: + - asasalint + - asciicheck + - bidichk + - bodyclose + #- containedctx + #- contextcheck + #- cyclop + - decorder + #- depguard + - dogsled + - dupl + - dupword + - durationcheck + - errcheck + - errchkjson + - errname + - errorlint + # - execinquery + - exhaustive + #- exhaustruct + # - forbidigo + - forcetypeassert + #- funlen + #- gci + - ginkgolinter + - gocheckcompilerdirectives + #- gochecknoglobals + - gochecknoinits + - gochecksumtype + #- gocognit + #- goconst + - gocritic + #- gocyclo + - godot + #- godox + #- goerr113 + #- gofmt + - gofumpt + - goheader + - goimports + #- gomnd + #- gomoddirectives + - gomodguard + - goprintffuncname + - gosec + - gosimple + - gosmopolitan + - govet + - grouper + - importas + #- inamedparam + #- interfacebloat + #- ireturn + #- lll + - loggercheck + #- maintidx + - makezero + - mirror + - misspell + #- musttag + - nakedret + #- nestif + - nilerr + #- nilnil + #- nlreturn + - noctx + #- nolintlint + #- nonamedreturns + - nosprintfhostport + #- paralleltest + #- perfsprint + - prealloc + - predeclared + - promlinter + - protogetter + - reassign + - revive + #- rowserrcheck + - sloglint + #- sqlclosecheck + - staticcheck + - stylecheck + - tagalign + #- tagliatelle + - tenv + - testableexamples + # - testifylint + #- testpackage + #- thelper + - tparallel + #- unconvert + - unparam + - unused + - usestdlibvars + #- varnamelen + #- wastedassign + - whitespace + #- wrapcheck + #- wsl + - zerologlint diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clipman-1.6.4/Makefile new/clipman-1.6.5/Makefile --- old/clipman-1.6.4/Makefile 2024-04-19 12:16:37.000000000 +0200 +++ new/clipman-1.6.5/Makefile 2025-10-10 16:53:38.000000000 +0200 @@ -1,6 +1,7 @@ OUTPUT_DIR = bin NAME := clipman GOLANGCI_LINT := $(shell command -v golangci-lint 2> /dev/null) +GOFUMPT := $(shell command -v gofumpt 2> /dev/null) all: lint $(OUTPUT_DIR)/$(NAME) @@ -14,3 +15,9 @@ lint: $(GOLANGCI_LINT) @echo "linting..." @$(GOLANGCI_LINT) run + +fumpt: + @find . -name '*.go'|xargs -P4 $(GOFUMPT) -w -extra + + +.PHONY: fumpt lint mkdir all diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clipman-1.6.4/README.md new/clipman-1.6.5/README.md --- old/clipman-1.6.4/README.md 2024-04-19 12:16:37.000000000 +0200 +++ new/clipman-1.6.5/README.md 2025-10-10 16:53:38.000000000 +0200 @@ -1,4 +1,4 @@ -# Fork of [clipman](https://github.com/yory8/clipman) +# Active Fork of [clipman](https://github.com/yory8/clipman) This is a fork of the archived clipman project. @@ -16,7 +16,7 @@ - `--min-char` minimum number of characters before storing -Will be happy to add more or accept contributions. +Will be happy to add more features and accept contributions. # Clipman @@ -37,7 +37,7 @@ - a selector: wofi and bemenu are specially supported, but you can use what you want - notify-send (optional, for desktop notifications) -[Install go](https://golang.org/doc/install), add `$GOPATH/bin` to your path, then run `go get github.com/chmouel/clipman` OR run `go install` inside this folder. +[Install go](https://golang.org/doc/install), add `$GOPATH/bin` to your path, then run `go install github.com/chmouel/clipman@latest` OR run `go install` inside this folder. ### Distros @@ -51,7 +51,8 @@ To query the history and select items, run the binary as `clipman pick -t wofi`. You can assign it to a keybinding: `bindsym $mod+h exec clipman pick -t wofi`. You can pass additional arguments to the selector like this: `clipman pick --tool wofi -T'--prompt=my-prompt -i'` (both `--prompt` and `-i` are flags of wofi). -You can use a custom selector like this: `clipman pick --print0 --tool=CUSTOM --tool-args="fzf --prompt 'pick > ' --bind 'tab:up' --cycle --read0"`. + +You can use a custom selector like this: `clipman pick --print0 --tool=CUSTOM --tool-args="fzf --prompt 'pick > ' --bind 'tab:up' --cycle --read0"`. Or: `clipman pick --normalize-unicode --tool=CUSTOM --tool-args="tofi"` to make clipman play nice with tools that produce NFC normalized Unicode. To remove items from history, `clipman clear -t wofi` and `clipman clear --all`. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clipman-1.6.4/docs/clipman.1 new/clipman-1.6.5/docs/clipman.1 --- old/clipman-1.6.4/docs/clipman.1 2024-04-19 12:16:37.000000000 +0200 +++ new/clipman-1.6.5/docs/clipman.1 2025-10-10 16:53:38.000000000 +0200 @@ -66,6 +66,9 @@ .TP \fB\-\-print0\fR Separate items using NULL; recommended if your tool supports \-\-read0 or similar +.TP +\fB\-\-normalize-unicode\fR +Normalize to NFC per https://unicode.org/reports/tr15 .SS \fBclear [<flags>]\fR .PP @@ -88,6 +91,9 @@ Separate items using NULL; recommended if your tool supports .B \-\-read0 or similar +.TP +\fB\-\-normalize-unicode\fR +Normalize to NFC per https://unicode.org/reports/tr15 .SS \fBrestore\fR .PP @@ -100,7 +106,7 @@ .nf \& .in +4m -.B exec wl\-paste \-t text \-\-watch clipman store +.B exec wl\-paste \-t text \-\-watch clipman store .in \& .fi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clipman-1.6.4/go.mod new/clipman-1.6.5/go.mod --- old/clipman-1.6.4/go.mod 2024-04-19 12:16:37.000000000 +0200 +++ new/clipman-1.6.5/go.mod 2025-10-10 16:53:38.000000000 +0200 @@ -1,8 +1,14 @@ module github.com/chmouel/clipman -go 1.13 +go 1.21 require ( github.com/alecthomas/kingpin/v2 v2.4.0 github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 + golang.org/x/text v0.22.0 +) + +require ( + github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b // indirect + github.com/xhit/go-str2duration/v2 v2.1.0 // indirect ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clipman-1.6.4/go.sum new/clipman-1.6.5/go.sum --- old/clipman-1.6.4/go.sum 2024-04-19 12:16:37.000000000 +0200 +++ new/clipman-1.6.5/go.sum 2025-10-10 16:53:38.000000000 +0200 @@ -1,7 +1,7 @@ github.com/alecthomas/kingpin/v2 v2.4.0 h1:f48lwail6p8zpO1bC4TxtqACaGqHYA22qkHjHpqDjYY= github.com/alecthomas/kingpin/v2 v2.4.0/go.mod h1:0gyi0zQnjuFk8xrkNKamJoyUo382HRL7ATRpFZCw6tE= -github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 h1:s6gZFSlWYmbqAuRjVTiNNhvNRfY2Wxp9nhfyel4rklc= -github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= +github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b h1:mimo19zliBX/vSQ6PWWSL9lK8qwHozUj03+zLoEB8O0= +github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b/go.mod h1:fvzegU4vN3H1qMT+8wDmzjAcDONcgo2/SZ/TyfdUOFs= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -12,16 +12,17 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/xhit/go-str2duration/v2 v2.1.0 h1:lxklc02Drh6ynqX+DdPyp5pCKLUQpRT8bp8Ydu2Bstc= github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM= +golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clipman-1.6.4/main.go new/clipman-1.6.5/main.go --- old/clipman-1.6.4/main.go 2024-04-19 12:16:37.000000000 +0200 +++ new/clipman-1.6.5/main.go 2025-10-10 16:53:38.000000000 +0200 @@ -7,7 +7,6 @@ "bytes" "encoding/json" "fmt" - "io/ioutil" "os" "os/exec" "strings" @@ -36,14 +35,19 @@ pickToolArgs = picker.Flag("tool-args", "Extra arguments to pass to the --tool").Short('T').Default("").String() pickEsc = picker.Flag("print0", "Separate items using NULL; recommended if your tool supports --read0 or similar").Default("false").Bool() errorOnNoSelection = picker.Flag("err-on-no-selection", "exit 1 when there is no selection").Default("false").Bool() + pickNormalize = picker.Flag("normalize-unicode", "normalize to NFC per https://unicode.org/reports/tr15").Default("false").Bool() - clearer = app.Command("clear", "Remove item/s from history") - maxClearer = clearer.Flag("max-items", "scrollview length").Default("15").Int() - clearTool = clearer.Flag("tool", "Which selector to use: wofi/bemenu/CUSTOM/dmenu/rofi/STDOUT").Short('t').String() - clearToolArgs = clearer.Flag("tool-args", "Extra arguments to pass to the --tool").Short('T').Default("").String() - clearAll = clearer.Flag("all", "Remove all items").Short('a').Default("false").Bool() - clearEsc = clearer.Flag("print0", "Separate items using NULL; recommended if your tool supports --read0 or similar").Default("false").Bool() - _ = app.Command("restore", "Serve the last recorded item from history") + clearer = app.Command("clear", "Remove item/s from history") + maxClearer = clearer.Flag("max-items", "scrollview length").Default("15").Int() + clearTool = clearer.Flag("tool", "Which selector to use: wofi/bemenu/CUSTOM/dmenu/rofi/STDOUT").Short('t').String() + clearToolArgs = clearer.Flag("tool-args", "Extra arguments to pass to the --tool").Short('T').Default("").String() + clearAll = clearer.Flag("all", "Remove all items").Short('a').Default("false").Bool() + clearEsc = clearer.Flag("print0", "Separate items using NULL; recommended if your tool supports --read0 or similar").Default("false").Bool() + clearNormalize = clearer.Flag("normalize-unicode", "normalize to NFC per https://unicode.org/reports/tr15").Default("false").Bool() + + _ = app.Command("show-history", "Show all items from history") + + _ = app.Command("restore", "Serve the last recorded item from history") ) func main() { @@ -80,7 +84,8 @@ smartLog(err.Error(), "critical", *alert) } case "pick": - selection, err := selector(history, *maxPicker, *pickTool, "pick", *pickToolArgs, *pickEsc, *errorOnNoSelection) + selection, err := selector( + history, *maxPicker, *pickTool, "pick", *pickToolArgs, *pickEsc, *errorOnNoSelection, *pickNormalize) if err != nil { smartLog(err.Error(), "normal", *alert) } @@ -98,8 +103,13 @@ serveTxt(history[len(history)-1]) case "show-history": if len(history) != 0 { - urlsJson, _ := json.Marshal(history) - fmt.Println(string(urlsJson)) + urlsJSON, err := json.Marshal(history) + if err != nil { + fmt.Printf("Error marshalling history: %s\n", err.Error()) + return + } + + fmt.Println(string(urlsJSON)) return } fmt.Println("Nothing to show") @@ -118,7 +128,8 @@ os.Exit(1) } - selection, err := selector(history, *maxClearer, *clearTool, "clear", *clearToolArgs, *clearEsc, *errorOnNoSelection) + selection, err := selector( + history, *maxClearer, *clearTool, "clear", *clearToolArgs, *clearEsc, *errorOnNoSelection, *clearNormalize) if err != nil { smartLog(err.Error(), "normal", *alert) } @@ -174,14 +185,14 @@ // read history if it exists var history []string - b, err := ioutil.ReadFile(histfile) + b, err := os.ReadFile(histfile) if err != nil { if !os.IsNotExist(err) { - return "", nil, fmt.Errorf("failure reading history file: %s", err) + return "", nil, fmt.Errorf("failure reading history file: %w", err) } } else { if err := json.Unmarshal(b, &history); err != nil { - return "", nil, fmt.Errorf("failure parsing history: %s", err) + return "", nil, fmt.Errorf("failure parsing history: %w", err) } } @@ -214,7 +225,20 @@ } } -// modified from standard lib to not drop \r and \n +// scanLines is a custom implementation of a split function for a bufio.Scanner. +// It has been modified from the standard library version to ensure that carriage return (\r) +// and newline (\n) characters are not dropped. This is important for maintaining the integrity +// of the input data, especially when dealing with text files or streams where these characters +// are significant. +// +// Parameters: +// - data: The byte slice to be scanned. +// - atEOF: A boolean indicating if the end of the file has been reached. +// +// Returns: +// - advance: The number of bytes to advance the input. +// - token: The next token to return to the user. +// - err: Any error encountered during scanning. func scanLines(data []byte, atEOF bool) (advance int, token []byte, err error) { if atEOF && len(data) == 0 { return 0, nil, nil @@ -242,7 +266,17 @@ return 0, nil, nil } -// dropCR drops a terminal \r from the data. Modified from Go's Stdlib +// dropCR drops a terminal \r from the data. This function has been modified from Go's +// standard library to ensure that carriage return (\r) characters are properly handled. +// It checks if the data ends with a newline (\n) and removes the preceding carriage return (\r) +// if present. This is useful for processing text data that may have different line ending +// conventions (e.g., Windows vs. Unix). +// +// Parameters: +// - data: The byte slice from which the terminal \r should be dropped. +// +// Returns: +// - A new byte slice with the terminal \r removed, if it was present. func dropCR(data []byte) []byte { orig := data diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clipman-1.6.4/notify.go new/clipman-1.6.5/notify.go --- old/clipman-1.6.4/notify.go 2024-04-19 12:16:37.000000000 +0200 +++ new/clipman-1.6.5/notify.go 2025-10-10 16:53:38.000000000 +0200 @@ -22,7 +22,7 @@ } } -func notify(message string, urgency string) error { +func notify(message, urgency string) error { var timeout time.Duration switch urgency { // cases accepted by notify-send: low, normal, critical @@ -40,5 +40,4 @@ args := []string{"-a", "Clipman", "-u", urgency, "-t", millisec, message} return exec.Command("notify-send", args...).Run() - } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clipman-1.6.4/selector.go new/clipman-1.6.5/selector.go --- old/clipman-1.6.4/selector.go 2024-04-19 12:16:37.000000000 +0200 +++ new/clipman-1.6.5/selector.go 2025-10-10 16:53:38.000000000 +0200 @@ -9,16 +9,17 @@ "strings" "github.com/kballard/go-shellquote" + "golang.org/x/text/unicode/norm" ) -func selector(data []string, max int, tool, prompt, toolArgs string, null, errorOnNoSelection bool) (string, error) { +func selector(data []string, maxChar int, tool, prompt, toolArgs string, null, errorOnNoSelection, normalize bool) (string, error) { if len(data) == 0 { return "", errors.New("nothing to show: no data available") } // output to stdout and return if tool == "STDOUT" { - escaped, _ := preprocessData(data, 0, !null) + escaped, _ := preprocessData(data, 0, !null, normalize) sep := "\n" if null { sep = "\000" @@ -39,15 +40,15 @@ "-fn", "-misc-dejavu sans mono-medium-r-normal--17-120-100-100-m-0-iso8859-16", "-l", - strconv.Itoa(max), + strconv.Itoa(maxChar), } case "bemenu": - args = []string{"bemenu", "--prompt", prompt, "--list", strconv.Itoa(max)} + args = []string{"bemenu", "--prompt", prompt, "--list", strconv.Itoa(maxChar)} case "rofi": args = []string{ "rofi", "-p", prompt, "-dmenu", "-lines", - strconv.Itoa(max), + strconv.Itoa(maxChar), } case "wofi": args = []string{"wofi", "-p", prompt, "--cache-file", "/dev/null", "--dmenu"} @@ -78,7 +79,7 @@ return "", fmt.Errorf("%s is not installed", tool) } - processed, guide := preprocessData(data, 1000, !null) + processed, guide := preprocessData(data, 1000, !null, normalize) sep := "\n" if null { sep = "\000" @@ -111,6 +112,10 @@ if b[len(b)-1] == '\n' { b = b[:len(b)-1] } + // normalize Unicode to NFC + if normalize { + b = norm.NFC.Bytes(b) + } sel, ok := guide[string(b)] if !ok { return "", errors.New("couldn't recover original string") @@ -123,13 +128,15 @@ // - reverses the data // - optionally escapes \n, \r and \t (it would break some external selectors) // - optionally it cuts items longer than maxChars bytes (dmenu doesn't allow more than ~1200) +// - optionally normalizes Unicode to NFC : https://unicode.org/reports/tr15/#Norm_Forms // A guide is created to allow restoring the selected item. -func preprocessData(data []string, maxChars int, escape bool) ([]string, map[string]string) { +func preprocessData(data []string, maxChars int, escape, normalize bool) ([]string, map[string]string) { var escaped []string guide := make(map[string]string) for i := len(data) - 1; i >= 0; i-- { // reverse slice original := data[i] + repr := original // escape newlines @@ -145,6 +152,10 @@ if maxChars > 0 && len(repr) > maxChars { repr = repr[:maxChars] } + // optionally normalize to Unicode NFC + if normalize { + repr = norm.NFC.String(repr) + } guide[repr] = original escaped = append(escaped, repr) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clipman-1.6.4/selector_test.go new/clipman-1.6.5/selector_test.go --- old/clipman-1.6.4/selector_test.go 1970-01-01 01:00:00.000000000 +0100 +++ new/clipman-1.6.5/selector_test.go 2025-10-10 16:53:38.000000000 +0200 @@ -0,0 +1,92 @@ +package main + +import ( + "testing" + + "golang.org/x/text/unicode/norm" +) + +func TestPreprocessDataNormalization(t *testing.T) { + // Test cases with different Unicode compositions + testCases := []struct { + name string + input []string + expected []string + }{ + { + name: "NFC vs NFD", + // "é" can be represented as single code point (NFC) or as "e" + combining accent (NFD) + input: []string{ + "café", // NFC form + "cafe\u0301", // NFD form (e + combining accent) + "résumé", // NFC form + "re\u0301sume\u0301", // NFD form + }, + expected: []string{ + "café", // All should be normalized to NFC + "café", + "résumé", + "résumé", + }, + }, + { + name: "Special Characters", + input: []string{ + "北京", // Chinese + "こんにちは", // Japanese + "안녕하세요", // Korean + "Москва", // Cyrillic + "ÄÖÜß", // German + "Ελληνικά", // Greek + "\u0915\u093e\u0928\u092a\u0941\u0930", // Devanagari + }, + // These should remain identical after NFC normalization + expected: []string{ + "北京", + "こんにちは", + "안녕하세요", + "Москва", + "ÄÖÜß", + "Ελληνικά", + "\u0915\u093e\u0928\u092a\u0941\u0930", + }, + }, + { + name: "Edge Cases", + input: []string{ + "\u1e9b\u0323", // NFC: ẛ̣ (Latin small letter long s with dot below) + "\u0073\u0323\u0307", // NFD: ṩ (s + dot below + dot above) + }, + expected: []string{ + "\u1e9b\u0323", + "\u1e69", // Should normalize to single code point + }, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + // Run with normalization enabled + processed, _ := preprocessData(tc.input, 0, false, true) + + // Reverse the processed data to match the original order (since preprocessData reverses) + reversed := make([]string, len(processed)) + for i := 0; i < len(processed); i++ { + reversed[i] = processed[len(processed)-1-i] + } + + // Verify each string is in NFC form + for i, str := range reversed { + // Check if the result is in NFC form + if !norm.NFC.IsNormalString(str) { + t.Errorf("Result not in NFC form: %q", str) + } + + // Check if the normalized form matches what we expect + if str != tc.expected[i] { + t.Errorf("Expected %q, got %q", tc.expected[i], str) + } + } + }) + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clipman-1.6.4/storer.go new/clipman-1.6.5/storer.go --- old/clipman-1.6.4/storer.go 2024-04-19 12:16:37.000000000 +0200 +++ new/clipman-1.6.5/storer.go 2025-10-10 16:53:38.000000000 +0200 @@ -3,10 +3,10 @@ import ( "encoding/json" "fmt" - "io/ioutil" + "os" ) -func store(text string, history []string, histfile string, max int, persist bool) error { +func store(text string, history []string, histfile string, maxChar int, persist bool) error { if text == "" { return nil } @@ -22,9 +22,9 @@ // drop oldest items that exceed max list size // if max = 0, we allow infinite history; NOTE: users should NOT rely on this behaviour as we might change it without notice - if max != 0 && l >= max { + if maxChar != 0 && l >= maxChar { // usually just one item, but more if we suddenly reduce our --max-items - history = history[l-max+1:] + history = history[l-maxChar+1:] } // remove duplicates @@ -35,7 +35,7 @@ // dump history to file so that other apps can query it if err := write(history, histfile); err != nil { - return fmt.Errorf("error writing history: %s", err) + return fmt.Errorf("error writing history: %w", err) } // make the copy buffer available to all applications, @@ -47,7 +47,7 @@ return nil } -// filter removes all occurrences of text +// filter removes all occurrences of text. func filter(slice []string, text string) []string { var filtered []string for _, s := range slice { @@ -59,12 +59,12 @@ return filtered } -// write dumps history to json file +// write dumps history to json file. func write(history []string, histfile string) error { b, err := json.Marshal(history) if err != nil { return err } - return ioutil.WriteFile(histfile, b, 0600) + return os.WriteFile(histfile, b, 0o600) } ++++++ vendor.tar.zst ++++++ ++++ 49542 lines of diff (skipped)
