)]}'
{"/PATCHSET_LEVEL":[{"author":{"_account_id":1000013,"name":"Profpatsch","email":"mail@profpatsch.de","username":"Profpatsch"},"change_message_id":"45c1cc66d3201a89de0f9753b7a5baccd22d7c15","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":5,"id":"a0fb6e6a_b198a76c","updated":"2022-02-13 18:00:18.000000000","message":"why not use, e.g. python at this point?","commit_id":"8b5a604a9c8a271ae772190d645e168bfc4d0a9c"},{"author":{"_account_id":1000001,"name":"tazjin","email":"tazjin@tvl.su","username":"tazjin"},"change_message_id":"28b9d23710863b832cd5e0a8a42b22da4766d055","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":9,"id":"158b393c_42e01215","updated":"2022-11-04 20:47:47.000000000","message":"I\u0027m fine with this as long as the existing comments are resolved where possible.","commit_id":"596fa7e24cfc4116bdeb7ef5e19e72ce18c332d2"}],"tools/rust-crates-advisory/default.nix":[{"author":{"_account_id":1000040,"name":"kn","email":"klemens@posteo.de","username":"kn"},"change_message_id":"abf309f4f86aec2da3e82ae28dd6a8c7c11ddf10","unresolved":true,"context_lines":[{"line_number":109,"context_line":"    status\u003dtrue"},{"line_number":110,"context_line":""},{"line_number":111,"context_line":"    while IFS\u003d read -r -d $\u0027\\0\u0027 lockFile; do"},{"line_number":112,"context_line":"      depotPath\u003d\"$(${bins.s6-dirname} \"$lockFile\" | ${bins.sed} \u0027s|^\\.|/|\u0027)\""},{"line_number":113,"context_line":""},{"line_number":114,"context_line":"      ${lock-file-report} \"$depotPath\" \"$lockFile\" || status\u003dfalse"},{"line_number":115,"context_line":"    done \u003c \u003c(${bins.find} \"\u0027\u0027${1:-.}\" -name Cargo.lock -and -type f -print0)"}],"source_content_type":"text/x-nix","patch_set":1,"id":"93bfe835_af855131","line":112,"updated":"2022-02-08 12:28:34.000000000","message":"Can you explain the `sed` part?\nDoes `${lock-file-report}` require an absoloute path?","commit_id":"cae1527dab14c4d7721f10136ac4c88ade2b5954"},{"author":{"_account_id":1000040,"name":"kn","email":"klemens@posteo.de","username":"kn"},"change_message_id":"7c65058b02f33b19a32abcfc17aec42a54f4c115","unresolved":false,"context_lines":[{"line_number":109,"context_line":"    status\u003dtrue"},{"line_number":110,"context_line":""},{"line_number":111,"context_line":"    while IFS\u003d read -r -d $\u0027\\0\u0027 lockFile; do"},{"line_number":112,"context_line":"      depotPath\u003d\"$(${bins.s6-dirname} \"$lockFile\" | ${bins.sed} \u0027s|^\\.|/|\u0027)\""},{"line_number":113,"context_line":""},{"line_number":114,"context_line":"      ${lock-file-report} \"$depotPath\" \"$lockFile\" || status\u003dfalse"},{"line_number":115,"context_line":"    done \u003c \u003c(${bins.find} \"\u0027\u0027${1:-.}\" -name Cargo.lock -and -type f -print0)"}],"source_content_type":"text/x-nix","patch_set":1,"id":"0cab6948_928aa01a","line":112,"in_reply_to":"5dbc7025_8e5e1e46","updated":"2022-02-08 13:42:04.000000000","message":"Ack","commit_id":"cae1527dab14c4d7721f10136ac4c88ade2b5954"},{"author":{"_account_id":1000034,"name":"sterni","email":"sternenseemann@systemli.org","username":"sterni"},"change_message_id":"3d02a6df21090b99628b9a069e3c97ef0290e932","unresolved":true,"context_lines":[{"line_number":109,"context_line":"    status\u003dtrue"},{"line_number":110,"context_line":""},{"line_number":111,"context_line":"    while IFS\u003d read -r -d $\u0027\\0\u0027 lockFile; do"},{"line_number":112,"context_line":"      depotPath\u003d\"$(${bins.s6-dirname} \"$lockFile\" | ${bins.sed} \u0027s|^\\.|/|\u0027)\""},{"line_number":113,"context_line":""},{"line_number":114,"context_line":"      ${lock-file-report} \"$depotPath\" \"$lockFile\" || status\u003dfalse"},{"line_number":115,"context_line":"    done \u003c \u003c(${bins.find} \"\u0027\u0027${1:-.}\" -name Cargo.lock -and -type f -print0)"}],"source_content_type":"text/x-nix","patch_set":1,"id":"5dbc7025_8e5e1e46","line":112,"in_reply_to":"93bfe835_af855131","updated":"2022-02-08 12:53:08.000000000","message":"The first parameter is just the label the lock file gets associated with in the final report. Assuming that we are at the root of depot, we get a path like `./foo/bar` and convert it to the familiar `//foo/bar` style path. Maybe this should be clarified in the code here as well.","commit_id":"cae1527dab14c4d7721f10136ac4c88ade2b5954"},{"author":{"_account_id":1000040,"name":"kn","email":"klemens@posteo.de","username":"kn"},"change_message_id":"abf309f4f86aec2da3e82ae28dd6a8c7c11ddf10","unresolved":true,"context_lines":[{"line_number":112,"context_line":"      depotPath\u003d\"$(${bins.s6-dirname} \"$lockFile\" | ${bins.sed} \u0027s|^\\.|/|\u0027)\""},{"line_number":113,"context_line":""},{"line_number":114,"context_line":"      ${lock-file-report} \"$depotPath\" \"$lockFile\" || status\u003dfalse"},{"line_number":115,"context_line":"    done \u003c \u003c(${bins.find} \"\u0027\u0027${1:-.}\" -name Cargo.lock -and -type f -print0)"},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"    exec $status"},{"line_number":118,"context_line":"  \u0027\u0027;"}],"source_content_type":"text/x-nix","patch_set":1,"id":"ba95a7e3_0d19f1b9","line":115,"updated":"2022-02-08 12:28:34.000000000","message":"Why not letting find(1) execute?\n\n`-execdir` puts you in the directory containing Cargo.lock, so you\u0027d get `$depoPath` for free as `.` or `$(pwd)`.\n`$lockFile` would always be \".../Cargo.lock\", so not even `{}` would be required, just \"./Cargo.lock\" since you\u0027re in the directory already.\n\nThere would be no need for looping manually and taking care of filenames with spaces as you do now.\n\n```\nfind \"${1:-.}\" -type f -name Cargo.lock -execdir \\\n    ${lock-file-report} . \u0027{}\u0027 \\;\n```\n\nGeneral note:  Filter for file type first, then for names, otherwise you wastefully compare directory names as well.\nAlso, `-and` is implied (just like you did between `-type f` and `-print0`).","commit_id":"cae1527dab14c4d7721f10136ac4c88ade2b5954"},{"author":{"_account_id":1000034,"name":"sterni","email":"sternenseemann@systemli.org","username":"sterni"},"change_message_id":"b172ee37ae6cc0c78fc4cc8e949f192322614581","unresolved":false,"context_lines":[{"line_number":112,"context_line":"      depotPath\u003d\"$(${bins.s6-dirname} \"$lockFile\" | ${bins.sed} \u0027s|^\\.|/|\u0027)\""},{"line_number":113,"context_line":""},{"line_number":114,"context_line":"      ${lock-file-report} \"$depotPath\" \"$lockFile\" || status\u003dfalse"},{"line_number":115,"context_line":"    done \u003c \u003c(${bins.find} \"\u0027\u0027${1:-.}\" -name Cargo.lock -and -type f -print0)"},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"    exec $status"},{"line_number":118,"context_line":"  \u0027\u0027;"}],"source_content_type":"text/x-nix","patch_set":1,"id":"3ce6e7fa_c42c60db","line":115,"in_reply_to":"ba95a7e3_0d19f1b9","updated":"2022-11-04 21:28:18.000000000","message":"Using -and, but -execdir doesn\u0027t seem to work out (see below).","commit_id":"cae1527dab14c4d7721f10136ac4c88ade2b5954"},{"author":{"_account_id":1000040,"name":"kn","email":"klemens@posteo.de","username":"kn"},"change_message_id":"abf309f4f86aec2da3e82ae28dd6a8c7c11ddf10","unresolved":true,"context_lines":[{"line_number":114,"context_line":"      ${lock-file-report} \"$depotPath\" \"$lockFile\" || status\u003dfalse"},{"line_number":115,"context_line":"    done \u003c \u003c(${bins.find} \"\u0027\u0027${1:-.}\" -name Cargo.lock -and -type f -print0)"},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"    exec $status"},{"line_number":118,"context_line":"  \u0027\u0027;"},{"line_number":119,"context_line":""},{"line_number":120,"context_line":"  check-all-our-lock-files \u003d depot.nix.writeExecline \"check-all-our-lock-files\" { } ["}],"source_content_type":"text/x-nix","patch_set":1,"id":"df2d83b0_cd353172","line":117,"updated":"2022-02-08 12:28:34.000000000","message":"find(1)\u0027s `-execdir command ;` would also have you covered wrt. the exit status (quote from the GNU manual):\n\n\u003e If any invocation returns a non-zero value as exit status,\n\u003e then find returns a non-zero exit status.\n\nGeneral note: No need for `exec` as `true` and `false` are shell builtins and you should use those rather than the executable from PATH.\n\nGiven that you only need it for the exit status, using `0`/`1` and `exit $status` would be simpler and explicit.","commit_id":"cae1527dab14c4d7721f10136ac4c88ade2b5954"},{"author":{"_account_id":1000040,"name":"kn","email":"klemens@posteo.de","username":"kn"},"change_message_id":"7c65058b02f33b19a32abcfc17aec42a54f4c115","unresolved":true,"context_lines":[{"line_number":114,"context_line":"      ${lock-file-report} \"$depotPath\" \"$lockFile\" || status\u003dfalse"},{"line_number":115,"context_line":"    done \u003c \u003c(${bins.find} \"\u0027\u0027${1:-.}\" -name Cargo.lock -and -type f -print0)"},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"    exec $status"},{"line_number":118,"context_line":"  \u0027\u0027;"},{"line_number":119,"context_line":""},{"line_number":120,"context_line":"  check-all-our-lock-files \u003d depot.nix.writeExecline \"check-all-our-lock-files\" { } ["}],"source_content_type":"text/x-nix","patch_set":1,"id":"a887a332_fa175ba4","line":117,"in_reply_to":"3e13a6fb_2ce77530","updated":"2022-02-08 13:42:04.000000000","message":"\u003e This doesn\u0027t seem to be the case from my testing, e. g. find . -type f -name \u0027Cargo.lock\u0027 -execdir \u0027bash\u0027 -c \u0027exit\u0027 \u00271\u0027 \\; will return 0 exit code for me sadly.\n\nYour quoting is wrong, bash\u0027s `-c` takes a single argument:\n```\n$ bash -c echo foo\n\n$ bash -c \u0027echo foo\u0027\nfoo\n```\n\nSo this must be `find ... -exec bash -c \u0027exit 1\u0027 \\;` for the command to actually return non-zero.\n\n\u003e also a bit worrying is:\n\u003e \n\u003e \u003e When some error occurs, find may stop immediately, without completing\n\u003e \u003e all the actions specified.\n\nToo bad we can\u0027t trust the documentation.\n\nBut you can still use find like this and simply do something when a command failed (nix-level escaping omitted):\n```\nfind \"${1:-.}\" -type f -name Cargo.lock \\\n    \\( -execdir bash -c \u0027${lock-file-report} /$(pwd) {}\u0027 \\; -o -print \\)\n```\n\nThis just prints the filename;  you can then check for non-empty output and exit non-zero accordingly.","commit_id":"cae1527dab14c4d7721f10136ac4c88ade2b5954"},{"author":{"_account_id":1000034,"name":"sterni","email":"sternenseemann@systemli.org","username":"sterni"},"change_message_id":"b172ee37ae6cc0c78fc4cc8e949f192322614581","unresolved":false,"context_lines":[{"line_number":114,"context_line":"      ${lock-file-report} \"$depotPath\" \"$lockFile\" || status\u003dfalse"},{"line_number":115,"context_line":"    done \u003c \u003c(${bins.find} \"\u0027\u0027${1:-.}\" -name Cargo.lock -and -type f -print0)"},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"    exec $status"},{"line_number":118,"context_line":"  \u0027\u0027;"},{"line_number":119,"context_line":""},{"line_number":120,"context_line":"  check-all-our-lock-files \u003d depot.nix.writeExecline \"check-all-our-lock-files\" { } ["}],"source_content_type":"text/x-nix","patch_set":1,"id":"3d4b0533_05ffc573","line":117,"in_reply_to":"a887a332_fa175ba4","updated":"2022-11-04 21:28:18.000000000","message":"I\u0027ve looked into it and the `-o` is neat, but not great, since we can\u0027t use it to influence the exit code (which will be `0` despite failures from my testing).\n\nWe would need to use some external means of signalling back to the script, a magic string or a created file which is both ugly. I\u0027ve opted to keep the loop and use your suggestion below.","commit_id":"cae1527dab14c4d7721f10136ac4c88ade2b5954"},{"author":{"_account_id":1000034,"name":"sterni","email":"sternenseemann@systemli.org","username":"sterni"},"change_message_id":"3d02a6df21090b99628b9a069e3c97ef0290e932","unresolved":true,"context_lines":[{"line_number":114,"context_line":"      ${lock-file-report} \"$depotPath\" \"$lockFile\" || status\u003dfalse"},{"line_number":115,"context_line":"    done \u003c \u003c(${bins.find} \"\u0027\u0027${1:-.}\" -name Cargo.lock -and -type f -print0)"},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"    exec $status"},{"line_number":118,"context_line":"  \u0027\u0027;"},{"line_number":119,"context_line":""},{"line_number":120,"context_line":"  check-all-our-lock-files \u003d depot.nix.writeExecline \"check-all-our-lock-files\" { } ["}],"source_content_type":"text/x-nix","patch_set":1,"id":"3e13a6fb_2ce77530","line":117,"in_reply_to":"df2d83b0_cd353172","updated":"2022-02-08 12:53:08.000000000","message":"This doesn\u0027t seem to be the case from my testing, e. g. find . -type f -name \u0027Cargo.lock\u0027 -execdir \u0027bash\u0027 -c \u0027exit\u0027 \u00271\u0027 \\; will return 0 exit code for me sadly.\n\nalso a bit worrying is:\n\n\u003e When some error occurs, find may stop immediately, without completing\n\u003e all the actions specified.","commit_id":"cae1527dab14c4d7721f10136ac4c88ade2b5954"},{"author":{"_account_id":1000040,"name":"kn","email":"klemens@posteo.de","username":"kn"},"change_message_id":"7c65058b02f33b19a32abcfc17aec42a54f4c115","unresolved":true,"context_lines":[{"line_number":113,"context_line":"    while IFS\u003d read -r -d $\u0027\\0\u0027 lockFile; do"},{"line_number":114,"context_line":"      label\u003d\"$("},{"line_number":115,"context_line":"        \"${bins.realpath}\" \"$(\"${bins.s6-dirname}\" \"$lockFile\")\" \\"},{"line_number":116,"context_line":"        | \"${bins.sed}\" \"s|^$root|/|\""},{"line_number":117,"context_line":"      )\""},{"line_number":118,"context_line":""},{"line_number":119,"context_line":"      \"${lock-file-report}\" \"$label\" \"$lockFile\" || status\u003d1"}],"source_content_type":"text/x-nix","patch_set":2,"id":"3c3e02e6_ffa7a896","line":116,"updated":"2022-02-08 13:42:04.000000000","message":"If you still want to go with a hand-rolled loop, you can leave the pretty-printing to find:\n\n(simplified code):\n```\nwhile read label lockFile; do\n    ${lock-file-report} \"$label\" \"$lockFile\" || status\u003d1\ndone \u003c(find ... -printf \u0027%h %P\\n\u0027)\n```\n\nSee find(1)\u0027s `-printf` documentation, it does exactly what you want wrt. stripping the root, getting the file name, etc.","commit_id":"ff37196ae4dae545c8837976ab7be2d1a2b63403"},{"author":{"_account_id":1000034,"name":"sterni","email":"sternenseemann@systemli.org","username":"sterni"},"change_message_id":"b172ee37ae6cc0c78fc4cc8e949f192322614581","unresolved":false,"context_lines":[{"line_number":113,"context_line":"    while IFS\u003d read -r -d $\u0027\\0\u0027 lockFile; do"},{"line_number":114,"context_line":"      label\u003d\"$("},{"line_number":115,"context_line":"        \"${bins.realpath}\" \"$(\"${bins.s6-dirname}\" \"$lockFile\")\" \\"},{"line_number":116,"context_line":"        | \"${bins.sed}\" \"s|^$root|/|\""},{"line_number":117,"context_line":"      )\""},{"line_number":118,"context_line":""},{"line_number":119,"context_line":"      \"${lock-file-report}\" \"$label\" \"$lockFile\" || status\u003d1"}],"source_content_type":"text/x-nix","patch_set":2,"id":"a7b2f8e1_c3d5d1a7","line":116,"in_reply_to":"3c3e02e6_ffa7a896","updated":"2022-11-04 21:28:18.000000000","message":"Done, improves the code a bit, but I couldn\u0027t drop the sed for the nice label :/","commit_id":"ff37196ae4dae545c8837976ab7be2d1a2b63403"}]}
