Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zfs diff -h/ZFS_DIFF_NO_MANGLE, diff cleanups #12829

Closed
wants to merge 7 commits into from

Conversation

nabijaczleweli
Copy link
Contributor

@nabijaczleweli nabijaczleweli commented Dec 10, 2021

Motivation and Context

If I have to write another instance of this

#include <stdio.h>
int main() {
	int c;
	while((c = getchar()) != EOF) {
		if(c == '\\') {
			c = 0;
			getchar(); // 0
			c = (c << 3) | (getchar() - '0');
			c = (c << 3) | (getchar() - '0');
			c = (c << 3) | (getchar() - '0');
		}
		putchar(c);
	}
}

to process stuff like this

-       /mnt/filling/store/BKP/D/Dokumenty/Domek/4.\0040sprz\0304\0231ty\0040i\0040materia\0305\0202y/_6\0040pompa\0040ciep\0305\0202a/Ochsner/!\0040panel\0040sterowania\0040w\0040salonie/2018.02\0040DSC_1928\0040-\0040panel\0040-\0040pod\0305\0202\0304\0205czenie\0040kabli.jpg
-       /mnt/filling/store/BKP/D/Dokumenty/b.\0040WCM/3.\0040Przyk\0305\0202ady/1.\0040PlatT/Zarz\0304\0205dzanie\0040Jako\0305\0233ci\0304\0205/tech-karty/IPSTLD\0040-\0040\0320\0242\0320\0265\0321\0205\0320\0275\0320\0276\0320\0273\0320\0276\0320\0263\0320\0270\0321\0207\0320\0265\0321\0201\0320\0272\0320\0260\0321\0217\0040\0320\0272\0320\0260\0321\0200\0321\0202\0320\0260\004028\0320\0245\0320\02232\0320\0242\0320\0240\0320\0243.xls/<xattrdir>

one more time just to read a diff I will return to monky, in a big way

Description

The first patch has the -p/NO_MANGLE flags for easy cherry-picking, the rest are NFC and explained in the messages.

Also, nominally, the %o with uint8_t argument should not work on big endian, but there didn't seem to be any tests validating that?

Went with -p for, dunno, printable? but not so sure about it. thots?

How Has This Been Tested?

Ran it. There's a new test, too, which CI will validate hopefully.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv) – new flag, but no ABI breaks I think?
  • Documentation (a change to man pages or other documentation)

Checklist:

  • My code follows the OpenZFS code style requirements.
  • I have updated the documentation accordingly.
  • I have read the contributing document.
  • I have added tests to cover my changes.
  • I have run the ZFS Test Suite with this change applied. – CI take my hand
  • All commit messages are properly formatted and contain Signed-off-by.

@nabijaczleweli
Copy link
Contributor Author

uuh FreeBSD HEAD CI failure appears unrelated?

@rincebrain
Copy link
Contributor

Personally, I just use this alias right now, and it's done the inputs I've needed so far, but I can't argue with wanting a builtin to print more human-readably without needing another thing to do it.
alias zfilt="while read -r LINE;do echo -e \"\${LINE}\";done"

Copy link
Contributor

@rincebrain rincebrain left a comment

Choose a reason for hiding this comment

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

Seems reasonable to me. Always pleased to see someone sand a rough edge off of zfs diff.

@nabijaczleweli nabijaczleweli force-pushed the zfs-diff-u branch 3 times, most recently from 92bbfb9 to 6b33153 Compare December 10, 2021 15:58
Copy link
Contributor

@behlendorf behlendorf left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for the improvement.

@@ -24,7 +24,6 @@
#include <stdlib.h>
#include <string.h>

/* ARGSUSED */
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: looks like this cleanup ended up in wrong commit.

@behlendorf behlendorf added the Status: Accepted Ready to integrate (reviewed, tested) label Dec 10, 2021
@nabijaczleweli
Copy link
Contributor Author

nabijaczleweli commented Dec 10, 2021

Fair enough, moved to the ARGSUSED one

@nabijaczleweli
Copy link
Contributor Author

The Debian 10 and CentOS 7 failures make no sense to me, since they're in casenorm/zpool expansion, which this doesn't touch?

@behlendorf
Copy link
Contributor

It looks like they hit unrelated issues. This should be good to go.

@behlendorf
Copy link
Contributor

Went with -p for, dunno, printable? but not so sure about it.

My only concern with this is we've used -p to mean "parsable" (exact values) in all of the other commands. While that behavior doesn't really apply for zfs diff, it'd probably be wise to leave -p unused (just in case we need it later). What if we used something like -h for human-readable?

@nabijaczleweli
Copy link
Contributor Author

nabijaczleweli commented Dec 10, 2021

In many ways this is the exact, unmangled, value, but -h works too, ya – updated

@behlendorf
Copy link
Contributor

Right, I can definitely see the argument for -p. I'm good with -h though, just to be on the safe side. @rincebrain thoughts?

@nabijaczleweli nabijaczleweli changed the title zfs diff -p/ZFS_DIFF_NO_MANGLE, diff cleanups zfs diff -h/ZFS_DIFF_NO_MANGLE, diff cleanups Dec 10, 2021
@rincebrain
Copy link
Contributor

-h sounds good to me - conceptually, I'd imagine that the default output of diff is only maybe one step removed from what we'd want from a --parsable anyway - since it's not really intended for direct human consumption, but ease of processing, all I'd really want on top would be some sort of serialization of the state of the from/to objects whenever it can't print the normal representations (e.g. any time it'd print an error).

behlendorf pushed a commit that referenced this pull request Dec 13, 2021
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Rich Ercolani <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes #12829
behlendorf pushed a commit that referenced this pull request Dec 13, 2021
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Rich Ercolani <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes #12829
behlendorf pushed a commit that referenced this pull request Dec 13, 2021
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Rich Ercolani <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes #12829
behlendorf pushed a commit that referenced this pull request Dec 13, 2021
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Rich Ercolani <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes #12829
nabijaczleweli added a commit to nabijaczleweli/zfs that referenced this pull request Mar 29, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Rich Ercolani <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Upstream-commit: 344bbc8
Closes openzfs#12829
nabijaczleweli added a commit to nabijaczleweli/zfs that referenced this pull request Mar 29, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Rich Ercolani <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Upstream-commit: a72129e
Closes openzfs#12829
behlendorf pushed a commit that referenced this pull request Apr 1, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Rich Ercolani <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Upstream-commit: 344bbc8
Closes #12829
behlendorf pushed a commit that referenced this pull request Apr 1, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Rich Ercolani <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Upstream-commit: a72129e
Closes #12829
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Rich Ercolani <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12829
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Rich Ercolani <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12829
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Found by clang 14 with -Wunused-but-set-variable

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Rich Ercolani <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12829
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Rich Ercolani <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12829
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Rich Ercolani <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12829
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Rich Ercolani <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12829
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Rich Ercolani <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12829
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Rich Ercolani <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12829
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Rich Ercolani <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12829
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Found by clang 14 with -Wunused-but-set-variable

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Rich Ercolani <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12829
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Rich Ercolani <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12829
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Rich Ercolani <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12829
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Rich Ercolani <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12829
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Rich Ercolani <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12829
tonyhutter pushed a commit to tonyhutter/zfs that referenced this pull request Jan 13, 2023
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Rich Ercolani <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12829
tonyhutter pushed a commit to tonyhutter/zfs that referenced this pull request Jan 13, 2023
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Rich Ercolani <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12829
tonyhutter pushed a commit to tonyhutter/zfs that referenced this pull request Jan 18, 2023
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Rich Ercolani <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12829
tonyhutter pushed a commit to tonyhutter/zfs that referenced this pull request Jan 18, 2023
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Rich Ercolani <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12829
tonyhutter pushed a commit to tonyhutter/zfs that referenced this pull request Jan 19, 2023
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Rich Ercolani <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12829
tonyhutter pushed a commit to tonyhutter/zfs that referenced this pull request Jan 19, 2023
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Rich Ercolani <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12829
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Ready to integrate (reviewed, tested)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants