Skip to content

zdb -A does not work as expected #10544

@sdimitro

Description

@sdimitro

I was using -A to work around an assertion failure for zdb and keep going but it wouldn't work (but -AA would).

The reason was the following looking in main() of zdb.c:

	int dump_all = 1;
	int verbose = 0;   
...
	while ((c = getopt(argc, argv,
	    "AbcCdDeEFGhiI:klLmMo:Op:PqRsSt:uU:vVx:XY")) != -1) {
		switch (c) {
...
		case 'A':
...
			dump_opt[c]++;      // <---- dump_opt['A'] set to 1
			break;
...
		default:
			usage();
			break;
		}
	}
...
	if (dump_all)
		verbose = MAX(verbose, 1);  // by default verbose is 1 
...
	for (c = 0; c < 256; c++) {
		if (dump_all && strchr("AeEFklLOPRSX", c) == NULL) // we skip this if clause
			dump_opt[c] = 1;
		if (dump_opt[c])                           // we do go into this one though
			dump_opt[c] += verbose;   // now dump_opt['A'] is 2
	}

	aok = (dump_opt['A'] == 1) || (dump_opt['A'] > 2); // aok is false because dump_opt['A'] is 2.
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: Userspaceuser space functionalityStatus: StaleNo recent activity for issueStatus: UnderstoodThe root cause of the issue is knownType: DefectIncorrect behavior (e.g. crash, hang)good first issueIndicates a good issue for first-time contributors

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions