Skip to content

fix: construct timespec with default() - #99

Merged
kotauskas merged 2 commits into
kotauskas:mainfrom
lotheac:push-oulvopzqsvqx
Oct 16, 2026
Merged

kotauskas merged 2 commits into
kotauskas:mainfrom
lotheac:push-oulvopzqsvqx

Conversation

@lotheac

@lotheac lotheac commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

depending on the libc crate version, target architecture and target libc, timespec may contain private padding fields. on such targets, rust 1.99.0 with libc 0.2.187 hits the following error:

error: cannot construct `timespec` with struct literal syntax due to private fields
   --> /home/buildozer/aports/community/kubie/tmp/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/interprocess-2.4.0/src/os/unix/c_wrappers.rs:435:8
    |
435 |     Ok(libc::timespec { tv_sec, tv_nsec: d.subsec_nanos() as _ })
    |        ^^^^^^^^^^^^^^
    |
    = note: ...and other private field `__pad0` that was not provided
help: consider using the `Default` trait
    |
435 -     Ok(libc::timespec { tv_sec, tv_nsec: d.subsec_nanos() as _ })
435 +     Ok(<libc::timespec as std::default::Default>::default())
    |

so, use timespec::default() to avoid the error. Default was implemented for timespec in libc 0.2.183, so bump the dependency.

depending on the libc crate version, target architecture and target
libc, timespec may contain private padding fields. on such targets, rust
1.99.0 with libc 0.2.187 hits the following error:

	error: cannot construct `timespec` with struct literal syntax due to private fields
	   --> /home/buildozer/aports/community/kubie/tmp/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/interprocess-2.4.0/src/os/unix/c_wrappers.rs:435:8
	    |
	435 |     Ok(libc::timespec { tv_sec, tv_nsec: d.subsec_nanos() as _ })
	    |        ^^^^^^^^^^^^^^
	    |
	    = note: ...and other private field `__pad0` that was not provided
	help: consider using the `Default` trait
	    |
	435 -     Ok(libc::timespec { tv_sec, tv_nsec: d.subsec_nanos() as _ })
	435 +     Ok(<libc::timespec as std::default::Default>::default())
	    |

so, use timespec::default() to avoid the error. Default was implemented
for timespec in libc 0.2.183, so bump the dependency.
algitbot pushed a commit to alpinelinux/aports that referenced this pull request Oct 16, 2026
kubie 0.28.0 transitively depends on interprocess via skim, and
interprocess has the following build issue on armv7:

	error: cannot construct `timespec` with struct literal syntax due to private fields
	   --> /home/buildozer/aports/community/kubie/tmp/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/interprocess-2.4.0/src/os/unix/c_wrappers.rs:435:8
	    |
	435 |     Ok(libc::timespec { tv_sec, tv_nsec: d.subsec_nanos() as _ })
	    |        ^^^^^^^^^^^^^^
	    |
	    = note: ...and other private field `__pad0` that was not provided
	help: consider using the `Default` trait
	    |
	435 -     Ok(libc::timespec { tv_sec, tv_nsec: d.subsec_nanos() as _ })
	435 +     Ok(<libc::timespec as std::default::Default>::default())
	    |

so, backport the updates to skim 5.1.0 from kubie master -- that removes
the interprocess dependency entirely.

Link: kotauskas/interprocess#99
@kotauskas
kotauskas merged commit 96b2d41 into kotauskas:main Oct 16, 2026
kotauskas added a commit that referenced this pull request Oct 16, 2026
depending on the libc crate version, target architecture and target libc,
`timespec` may contain private padding fields. Use `timespec::default()` to
avoid the error. Default was implemented for timespec in libc 0.2.183, so bump
the dependency.

---------

Co-authored-by: Goat <v.toncharov@gmail.com>
kotauskas added a commit that referenced this pull request Oct 16, 2026
depending on the libc crate version, target architecture and target libc,
`timespec` may contain private padding fields. Use `timespec::default()` to
avoid the error. Default was implemented for timespec in libc 0.2.183, so bump
the dependency.

---------

Co-authored-by: Goat <v.toncharov@gmail.com>
kotauskas added a commit that referenced this pull request Oct 16, 2026
depending on the libc crate version, target architecture and target libc,
`timespec` may contain private padding fields. Use `timespec::default()` to
avoid the error. Default was implemented for timespec in libc 0.2.183, so bump
the dependency.

---------

Co-authored-by: Goat <v.toncharov@gmail.com>
kotauskas added a commit that referenced this pull request Oct 16, 2026
depending on the libc crate version, target architecture and target libc,
`timespec` may contain private padding fields. Use `timespec::default()` to
avoid the error. Default was implemented for timespec in libc 0.2.183, so bump
the dependency.

---------

Co-authored-by: Goat <v.toncharov@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants