Skip to content

krep: init at 0.3.4#392965

Merged
FliegendeWurst merged 1 commit intoNixOS:masterfrom
codebam:krep
Apr 3, 2025
Merged

krep: init at 0.3.4#392965
FliegendeWurst merged 1 commit intoNixOS:masterfrom
codebam:krep

Conversation

@codebam
Copy link
Contributor

@codebam codebam commented Mar 25, 2025

https://github.com/davidesantangelo/krep is a search tool, similar to grep.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@codebam
Copy link
Contributor Author

codebam commented Mar 25, 2025

This is tested and working. Let me know if anything needs to be done

@github-actions github-actions bot added 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Mar 25, 2025
@0xda157
Copy link
Contributor

0xda157 commented Mar 25, 2025

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 392965


x86_64-linux

✅ 1 package built:
  • krep

Copy link
Contributor

@0xda157 0xda157 left a comment

Choose a reason for hiding this comment

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

the bin seems to be fully working

@0xda157 0xda157 added the 8.has: package (new) This PR adds a new package label Mar 25, 2025
@codebam
Copy link
Contributor Author

codebam commented Mar 25, 2025

Changed as requested, thanks. Let me know if there's anything else

@codebam
Copy link
Contributor Author

codebam commented Mar 25, 2025

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 392965


x86_64-linux

✅ 1 package built:
  • krep

Copy link
Contributor

@0xda157 0xda157 left a comment

Choose a reason for hiding this comment

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

lgtm

@wegank wegank added the 12.approvals: 1 This PR was reviewed and approved by one person. label Mar 25, 2025
@FliegendeWurst
Copy link
Member

The makefile should be patched to allow any CC. For example, on Darwin where clang is the default:

   > gcc -Wall -Wextra -O3 -std=c11 -pthread -D_GNU_SOURCE -D_DEFAULT_SOURCE -c krep.c -o krep.o
   > make: gcc: No such file or directory
   > make: *** [Makefile:86: krep.o] Error 127

@codebam codebam force-pushed the krep branch 2 times, most recently from 565a5d8 to d2ad079 Compare March 28, 2025 17:51
@codebam codebam changed the title krep: init at 0.1.7 krep: init at 0.2.1 Mar 28, 2025
@codebam
Copy link
Contributor Author

codebam commented Mar 28, 2025

Package still builds and works. One thing though, the maintainer put 0.2.2 instead of 0.2.1 here so the built program says it's version 0.2.2

davidesantangelo/krep#15

@FliegendeWurst
Copy link
Member

Hmm.. it seems the program still lacks basic functionality.

For example, the flag -c Count matches only (don't print matching lines) is always active. In fact there is no way to print the matching lines.

@codebam
Copy link
Contributor Author

codebam commented Mar 29, 2025

Yeah you're right hmm. Not very useful like this

@codebam codebam changed the title krep: init at 0.2.1 krep: init at 0.3.3 Apr 2, 2025
@codebam
Copy link
Contributor Author

codebam commented Apr 2, 2025

❯ ./result/bin/krep 'krep' pkgs/by-name/kr/krep/package.nix
Warning: Line printing forces single-threaded mode (-t ignored).
pkgs/by-name/kr/krep/package.nix:  pname = "krep";
pkgs/by-name/kr/krep/package.nix:    repo = "krep";
pkgs/by-name/kr/krep/package.nix:    homepage = "https://github.com/davidesantangelo/krep";
pkgs/by-name/kr/krep/package.nix:    changelog = "https://github.com/davidesantangelo/krep/releases/tag/v${finalAttrs.version}";
--- Total Matches: 4 ---
Search completed in 0.0001 seconds (14.11 MB/s)
Search details:
  - File size: 0.00 MB (952 bytes)
  - Pattern length: 4 characters
  - Pattern type: Literal text
  - Execution: Single-threaded (1 thread)
  - Algorithm used: Boyer-Moore-Horspool
  - SIMD Available: No (Using scalar algorithms)
  - Case-sensitive search

The application supports printing matches now

@FliegendeWurst
Copy link
Member

Still looks buggy, e.g.

$ seq 1 10000 > /tmp/x && krep '11' /tmp/x | head -n20
Warning: Line printing forces single-threaded mode (-t ignored).
/tmp/x:11
/tmp/x:110
/tmp/x:111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128

@codebam
Copy link
Contributor Author

codebam commented Apr 2, 2025

Yeah tests fail too:

error: builder for '/nix/store/7bsiz0pd1b837nw67gdnirkfzjp36d1g-krep-0.3.3.drv' failed with exit code 2;
       last 19 log lines:
       > Running phase: unpackPhase
       > unpacking source archive /nix/store/bywhfcgs7zdndd98g4q0nys8zas4rzz9-source
       > source root is source
       > Running phase: patchPhase
       > Running phase: updateAutotoolsGnuConfigScriptsPhase
       > Running phase: configurePhase
       > no configure script, doing nothing
       > Running phase: buildPhase
       > build flags: SHELL=/nix/store/58br4vk3q5akf4g8lx0pqzfhn47k3j8d-bash-5.2p37/bin/bash CC=cc ENABLE_ARCH_DETECTION=0
       > cc -Wall -Wextra -O3 -std=c11 -pthread -D_GNU_SOURCE -D_DEFAULT_SOURCE -c krep.c -o krep.o
       > cc -Wall -Wextra -O3 -std=c11 -pthread -D_GNU_SOURCE -D_DEFAULT_SOURCE -o krep krep.o
       > Running phase: checkPhase
       > gcc -Wall -Wextra -O3 -std=c11 -pthread -D_GNU_SOURCE -D_DEFAULT_SOURCE -DTESTING -c test/test_krep.c -o test/test_krep.o
       > gcc -Wall -Wextra -O3 -std=c11 -pthread -D_GNU_SOURCE -D_DEFAULT_SOURCE -DTESTING -c test/test_regex.c -o test/test_regex.o
       > gcc -Wall -Wextra -O3 -std=c11 -pthread -D_GNU_SOURCE -D_DEFAULT_SOURCE -DTESTING -o test_krep test/test_krep.o test/test_regex.o krep.o
       > /nix/store/s40y31bdn82sj6daaxid1bn3p7la03lv-binutils-2.43.1/bin/ld: krep.o: in function `main':
       > krep.c:(.text.startup+0x6c0): multiple definition of `main'; test/test_krep.o:test_krep.c:(.text.startup+0x0): first defined here
       > collect2: error: ld returned 1 exit status
       > make: *** [Makefile:91: test] Error 1
       For full logs, run 'nix log /nix/store/7bsiz0pd1b837nw67gdnirkfzjp36d1g-krep-0.3.3.drv'.

@davidesantangelo
Copy link

I have released version 0.3.4 which should fix the reported bugs. Thanks again for the feedback.

@FliegendeWurst
Copy link
Member

FliegendeWurst commented Apr 3, 2025

Version 0.3.4 passes tests and seems to work fine. Match printing (or tracking?) is a little slow but not too bad.

$ seq 1 100000 > /tmp/x; pat=1; LANG= time krep $pat /tmp/x | wc -l; LANG= time rg $pat /tmp/x | wc -l
Warning: Line printing forces single-threaded mode (-t ignored).
1.94user 0.00system 0:01.95elapsed 99%CPU (0avgtext+0avgdata 3328maxresident)k
0inputs+0outputs (0major+400minor)pagefaults 0swaps
40963
0.00user 0.00system 0:00.00elapsed 80%CPU (0avgtext+0avgdata 6656maxresident)k
0inputs+0outputs (0major+698minor)pagefaults 0swaps
40952

@davidesantangelo
Copy link

Version 0.3.4 passes tests and seems to work fine. Match printing (or tracking?) is a little slow but not too bad.

$ seq 1 100000 > /tmp/x; pat=1; LANG= time krep $pat /tmp/x | wc -l; LANG= time rg $pat /tmp/x | wc -l
Warning: Line printing forces single-threaded mode (-t ignored).
1.94user 0.00system 0:01.95elapsed 99%CPU (0avgtext+0avgdata 3328maxresident)k
0inputs+0outputs (0major+400minor)pagefaults 0swaps
40963
0.00user 0.00system 0:00.00elapsed 80%CPU (0avgtext+0avgdata 6656maxresident)k
0inputs+0outputs (0major+698minor)pagefaults 0swaps
40952

yes I am working to improve speed on all architectures. Thanks!

@codebam codebam changed the title krep: init at 0.3.3 krep: init at 0.3.4 Apr 3, 2025
@FliegendeWurst FliegendeWurst merged commit 734650a into NixOS:master Apr 3, 2025
33 of 35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

8.has: package (new) This PR adds a new package 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

Comments