- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1
WIP List more attributes for data sets #625
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
base: main
Are you sure you want to change the base?
Conversation
| Server artifacts: | 
91f4c3e    to
    8071a96      
    Compare
  
    | Client artifacts: | 
Signed-off-by: Fernando Rijo Cedeno <[email protected]>
Signed-off-by: Fernando Rijo Cedeno <[email protected]>
| if (memcmp(dir_entry.name, &zero, sizeof(zero)) == 0) | ||
| { | ||
| // Empty entry - skip it but continue | ||
| data = data + sizeof(dir_entry); | 
Check failure
Code scanning / CodeQL
Suspicious add with sizeof High
unsigned char *
Copilot Autofix
AI about 8 hours ago
Copilot could not generate an autofix suggestion
Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.
| unsigned char info = dir_entry.info; | ||
| info &= 0x1F; // bits 3-7 contain the number of half words of user data | ||
|  | ||
| data = data + sizeof(dir_entry) + (info * 2); // skip number of half words | 
Check failure
Code scanning / CodeQL
Suspicious add with sizeof High
unsigned char *
Copilot Autofix
AI about 8 hours ago
Copilot could not generate an autofix suggestion
Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.
| if (rc == RTNCD_SUCCESS) | ||
| { | ||
| // FILE *debug_fp = fopen("/tmp/znp-ds-attrs.txt", "a"); | ||
| // if (debug_fp) | ||
| // { | ||
| // fprintf(debug_fp, "\n=== Dataset: %s ===\n", entry.name.c_str()); | ||
| // // DSCB Format-1 is 140 bytes (0x8C), use fixed size instead of sizeof | ||
| // const size_t DSCB_SIZE = 140; | ||
| // fprintf(debug_fp, "DSCB Hex Dump (%zu bytes, sizeof=%zu):\n", DSCB_SIZE, sizeof(DSCBFormat1)); | ||
|  | ||
| // unsigned char *dscb_bytes = (unsigned char *)dscb; | ||
| // for (size_t i = 0; i < DSCB_SIZE; i++) | ||
| // { | ||
| // if (i % 16 == 0) | ||
| // fprintf(debug_fp, "%04zX: ", i); | ||
| // fprintf(debug_fp, "%02X ", dscb_bytes[i]); | ||
| // if ((i + 1) % 16 == 0) | ||
| // fprintf(debug_fp, "\n"); | ||
| // } | ||
| // if (DSCB_SIZE % 16 != 0) | ||
| // fprintf(debug_fp, "\n"); | ||
|  | ||
| // fclose(debug_fp); | ||
| // } | ||
| } | 
Check notice
Code scanning / CodeQL
Futile conditional Note
          
            
              
                
              
            
            Show autofix suggestion
            Hide autofix suggestion
          
      Copilot Autofix
AI about 23 hours ago
To address this issue, remove the pointless if (rc == RTNCD_SUCCESS) { ... } block that houses only commented code (lines 1208–1232). The condition is checked and handled properly later (line 1234 onward), so there is no functional need for this now-empty block. Deleting these lines removes confusion and cleans up the code without altering any active functionality.
- Only edit native/c/zds.cpp.
- Remove lines 1208–1232, inclusive.
| @@ -1205,32 +1205,7 @@ | ||
| const auto rc = ZDSDSCB1(zds, entry.name.c_str(), entry.volser.c_str(), dscb); | ||
|  | ||
| // DEBUG: Dump DSCB to file | ||
| if (rc == RTNCD_SUCCESS) | ||
| { | ||
| // FILE *debug_fp = fopen("/tmp/znp-ds-attrs.txt", "a"); | ||
| // if (debug_fp) | ||
| // { | ||
| // fprintf(debug_fp, "\n=== Dataset: %s ===\n", entry.name.c_str()); | ||
| // // DSCB Format-1 is 140 bytes (0x8C), use fixed size instead of sizeof | ||
| // const size_t DSCB_SIZE = 140; | ||
| // fprintf(debug_fp, "DSCB Hex Dump (%zu bytes, sizeof=%zu):\n", DSCB_SIZE, sizeof(DSCBFormat1)); | ||
|  | ||
| // unsigned char *dscb_bytes = (unsigned char *)dscb; | ||
| // for (size_t i = 0; i < DSCB_SIZE; i++) | ||
| // { | ||
| // if (i % 16 == 0) | ||
| // fprintf(debug_fp, "%04zX: ", i); | ||
| // fprintf(debug_fp, "%02X ", dscb_bytes[i]); | ||
| // if ((i + 1) % 16 == 0) | ||
| // fprintf(debug_fp, "\n"); | ||
| // } | ||
| // if (DSCB_SIZE % 16 != 0) | ||
| // fprintf(debug_fp, "\n"); | ||
|  | ||
| // fclose(debug_fp); | ||
| // } | ||
| } | ||
|  | ||
| if (rc == RTNCD_SUCCESS) | ||
| { | ||
| load_dsorg_from_dscb(dscb, &entry.dsorg); | 
| // FILE *debug_fp = fopen("/tmp/znp-ds-attrs.txt", "a"); | ||
| // if (debug_fp) | ||
| // { | ||
| // fprintf(debug_fp, "\n=== Dataset: %s ===\n", entry.name.c_str()); | ||
| // // DSCB Format-1 is 140 bytes (0x8C), use fixed size instead of sizeof | ||
| // const size_t DSCB_SIZE = 140; | ||
| // fprintf(debug_fp, "DSCB Hex Dump (%zu bytes, sizeof=%zu):\n", DSCB_SIZE, sizeof(DSCBFormat1)); | 
Check notice
Code scanning / CodeQL
Commented-out code Note
          
            
              
                
              
            
            Show autofix suggestion
            Hide autofix suggestion
          
      Copilot Autofix
AI about 23 hours ago
The best way to fix this problem is to remove the commented-out code block entirely. If the ability to debug the DSCB contents is occasionally needed, then a conditional compilation (such as with a #ifdef DEBUG guard or similar) could be introduced. However, unless such debugging is an ongoing requirement, it is cleaner and simpler to completely remove the commented-out lines.
Specifically, in the zds_get_attrs_from_dscb function (starting at line 1196), remove lines 1210–1231: the block of commented-out code for dumping the DSCB to a file. Retain the rest of the function, including the (also commented) line 1207 "// DEBUG: Dump DSCB to file", as this is not commented-out code but a marker/reminder. No header or import changes are needed.
| @@ -1207,28 +1207,6 @@ | ||
| // DEBUG: Dump DSCB to file | ||
| if (rc == RTNCD_SUCCESS) | ||
| { | ||
| // FILE *debug_fp = fopen("/tmp/znp-ds-attrs.txt", "a"); | ||
| // if (debug_fp) | ||
| // { | ||
| // fprintf(debug_fp, "\n=== Dataset: %s ===\n", entry.name.c_str()); | ||
| // // DSCB Format-1 is 140 bytes (0x8C), use fixed size instead of sizeof | ||
| // const size_t DSCB_SIZE = 140; | ||
| // fprintf(debug_fp, "DSCB Hex Dump (%zu bytes, sizeof=%zu):\n", DSCB_SIZE, sizeof(DSCBFormat1)); | ||
|  | ||
| // unsigned char *dscb_bytes = (unsigned char *)dscb; | ||
| // for (size_t i = 0; i < DSCB_SIZE; i++) | ||
| // { | ||
| // if (i % 16 == 0) | ||
| // fprintf(debug_fp, "%04zX: ", i); | ||
| // fprintf(debug_fp, "%02X ", dscb_bytes[i]); | ||
| // if ((i + 1) % 16 == 0) | ||
| // fprintf(debug_fp, "\n"); | ||
| // } | ||
| // if (DSCB_SIZE % 16 != 0) | ||
| // fprintf(debug_fp, "\n"); | ||
|  | ||
| // fclose(debug_fp); | ||
| // } | ||
| } | ||
|  | ||
| if (rc == RTNCD_SUCCESS) | 
| // unsigned char *dscb_bytes = (unsigned char *)dscb; | ||
| // for (size_t i = 0; i < DSCB_SIZE; i++) | ||
| // { | ||
| // if (i % 16 == 0) | ||
| // fprintf(debug_fp, "%04zX: ", i); | ||
| // fprintf(debug_fp, "%02X ", dscb_bytes[i]); | ||
| // if ((i + 1) % 16 == 0) | ||
| // fprintf(debug_fp, "\n"); | ||
| // } | ||
| // if (DSCB_SIZE % 16 != 0) | ||
| // fprintf(debug_fp, "\n"); | 
Check notice
Code scanning / CodeQL
Commented-out code Note
          
            
              
                
              
            
            Show autofix suggestion
            Hide autofix suggestion
          
      Copilot Autofix
AI about 23 hours ago
To address the problem, the commented-out debug hex dump code (lines 1210–1231 in the provided snippet) should be either removed completely, or—if its functionality is genuinely useful for future debugging—reinstated under a conditional compilation flag (such as #ifdef ZDS_DEBUG_DSCB_DUMP). This approach preserves the utility of the debug code for maintainers while keeping production code clean and free of clutter. If the code is not meant to be reactivated, it should simply be deleted. In this context, the best fix is to remove the commented debug code, given there's no indication it's needed for future maintenance.
Edits are restricted to the block of commented-out debug statements within native/c/zds.cpp, specifically lines 1210–1231.
- 
    
    
    Copy modified line R1210 
| @@ -1207,28 +1207,7 @@ | ||
| // DEBUG: Dump DSCB to file | ||
| if (rc == RTNCD_SUCCESS) | ||
| { | ||
| // FILE *debug_fp = fopen("/tmp/znp-ds-attrs.txt", "a"); | ||
| // if (debug_fp) | ||
| // { | ||
| // fprintf(debug_fp, "\n=== Dataset: %s ===\n", entry.name.c_str()); | ||
| // // DSCB Format-1 is 140 bytes (0x8C), use fixed size instead of sizeof | ||
| // const size_t DSCB_SIZE = 140; | ||
| // fprintf(debug_fp, "DSCB Hex Dump (%zu bytes, sizeof=%zu):\n", DSCB_SIZE, sizeof(DSCBFormat1)); | ||
|  | ||
| // unsigned char *dscb_bytes = (unsigned char *)dscb; | ||
| // for (size_t i = 0; i < DSCB_SIZE; i++) | ||
| // { | ||
| // if (i % 16 == 0) | ||
| // fprintf(debug_fp, "%04zX: ", i); | ||
| // fprintf(debug_fp, "%02X ", dscb_bytes[i]); | ||
| // if ((i + 1) % 16 == 0) | ||
| // fprintf(debug_fp, "\n"); | ||
| // } | ||
| // if (DSCB_SIZE % 16 != 0) | ||
| // fprintf(debug_fp, "\n"); | ||
|  | ||
| // fclose(debug_fp); | ||
| // } | ||
| // DEBUG: Previously, hex dump of DSCB was written to file for debugging. | ||
| } | ||
|  | ||
| if (rc == RTNCD_SUCCESS) | 
| // fclose(debug_fp); | ||
| // } | 
Check notice
Code scanning / CodeQL
Commented-out code Note
| } | ||
| else | ||
| { | ||
| load_recfm_from_dscb(dscb, &entry.recfm); | 
Check warning
Code scanning / CodeQL
Expression has no effect Warning
load_recfm_from_dscb
Copilot Autofix
AI about 8 hours ago
Copilot could not generate an autofix suggestion
Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.
Signed-off-by: Timothy Johnson <[email protected]>
Signed-off-by: Timothy Johnson <[email protected]>
Signed-off-by: Timothy Johnson <[email protected]>
b464a85    to
    9828229      
    Compare
  
    | 
 | 
Signed-off-by: Fernando Rijo Cedeno <[email protected]>


What It Does
How to Test
Review Checklist
I certify that I have:
Additional Comments