uros-b commented on code in PR #57414:
URL: https://github.com/apache/spark/pull/57414#discussion_r3683449687


##########
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/TarArchiveTestUtils.scala:
##########
@@ -62,4 +62,31 @@ trait TarArchiveTestUtils {
   protected def writeCorruptArchive(dest: File): Unit =
     Files.write(dest.toPath, "this is not a valid gzip-compressed tar archive"
       .getBytes(StandardCharsets.UTF_8))
+
+  protected def supportsMidAdvanceFailure: Boolean = true
+
+  /**
+   * Writes a plain `.tar` (uncompressed, so the first entry survives 
truncation) with `firstEntry`
+   * intact followed by a second entry whose header is cut short, so 
`getNextEntry` throws while
+   * advancing to it.
+   */
+  protected def writeArchiveFailingAfterFirstEntry(

Review Comment:
   Nit: test helper is a bit fragile, writeArchiveFailingAfterFirstEntry 
computes the truncation point as 512 + roundUp(len, 512), which assumes the 
entry name fits the 100-byte ustar name field. A longer name adds GNU/PAX 
header blocks and silently shifts the offset, quietly turning this into an 
open-failure test instead of a mid-advance one. entryName(0) is short today; an 
assertion or a stated assumption would be good.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to