Skip to content

tsh: Add wrapper for syscall.Dup2 for linux/arm64#55925

Merged
camscale merged 3 commits intomasterfrom
camh/dup3-on-arm64
Jun 23, 2025
Merged

tsh: Add wrapper for syscall.Dup2 for linux/arm64#55925
camscale merged 3 commits intomasterfrom
camh/dup3-on-arm64

Conversation

@camscale
Copy link
Copy Markdown
Contributor

Add a wrapper for syscall.Dup2() as linux ARM64 does not have that
syscall. On that platform, syscall.Dup3() needs to be used instead.

Fixes: 57c909d
Related: #54696

@camscale camscale added the no-changelog Indicates that a PR does not require a changelog entry label Jun 20, 2025
@camscale camscale requested a review from atburke June 20, 2025 02:26
@github-actions github-actions Bot added size/sm tsh tsh - Teleport's command line tool for logging into nodes running Teleport. labels Jun 20, 2025
@github-actions github-actions Bot requested review from bl-nero and probakowski June 20, 2025 02:26
@camscale camscale force-pushed the camh/dup3-on-arm64 branch from 8714b50 to 1b05da7 Compare June 20, 2025 02:31
@camscale camscale changed the title tsh: Wrap syscall.Dup2 for linux/arm64 tsh: Add wrapper for syscall.Dup2 for linux/arm64 Jun 20, 2025
@camscale camscale force-pushed the camh/dup3-on-arm64 branch from 1b05da7 to 4cad3bd Compare June 20, 2025 05:06
Add a wrapper for `syscall.Dup2()` as linux ARM64 does not have that
syscall. On that platform, `syscall.Dup3()` needs to be used instead.

Fixes: 57c909d
@camscale camscale force-pushed the camh/dup3-on-arm64 branch from 4cad3bd to 8ac1321 Compare June 20, 2025 05:06
Comment thread tool/tsh/common/dup2_linux_arm64.go Outdated
Comment thread tool/tsh/common/reexec_unix.go Outdated
Comment thread tool/tsh/common/dup2_unix.go Outdated
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

//go:build !linux
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think windows has syscall.Dup2, and tsh is one of those things that we build for windows too.

Suggested change
//go:build !linux
//go:build unix && !linux

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

my expectation was that the _unix in the filename added that constraint, but I'll add it here to be sure.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It does not, unix is a valid build constraint but not one that gets checked as part of implicit constraints in filenames (https://pkg.go.dev/cmd/go#hdr-Build_constraints) because those are only for GOOS and/or GOARCH. 🥲

@camscale camscale enabled auto-merge June 23, 2025 10:24
@camscale camscale added this pull request to the merge queue Jun 23, 2025
Merged via the queue into master with commit b3a3066 Jun 23, 2025
40 checks passed
@camscale camscale deleted the camh/dup3-on-arm64 branch June 23, 2025 11:06
atburke pushed a commit that referenced this pull request Jun 24, 2025
* tsh: Add wrapper for syscall.Dup2 for linux/arm64

Add a wrapper for `syscall.Dup2()` as linux ARM64 does not have that
syscall. On that platform, `syscall.Dup3()` needs to be used instead.

Fixes: 57c909d

* Implement dup2 with syscall.Dup3 on all linux platforms

* Add explicit "unix" constraint to dup2_unix.go to ensure Windows is excluded
atburke pushed a commit that referenced this pull request Jun 24, 2025
* tsh: Add wrapper for syscall.Dup2 for linux/arm64

Add a wrapper for `syscall.Dup2()` as linux ARM64 does not have that
syscall. On that platform, `syscall.Dup3()` needs to be used instead.

Fixes: 57c909d

* Implement dup2 with syscall.Dup3 on all linux platforms

* Add explicit "unix" constraint to dup2_unix.go to ensure Windows is excluded
github-merge-queue Bot pushed a commit that referenced this pull request Jun 24, 2025
* Add fork after authentication for tsh ssh (#54696)

This change adds fork after authentication support
to tsh ssh.

* tsh: Add wrapper for syscall.Dup2 for linux/arm64 (#55925)

* tsh: Add wrapper for syscall.Dup2 for linux/arm64

Add a wrapper for `syscall.Dup2()` as linux ARM64 does not have that
syscall. On that platform, `syscall.Dup3()` needs to be used instead.

Fixes: 57c909d

* Implement dup2 with syscall.Dup3 on all linux platforms

* Add explicit "unix" constraint to dup2_unix.go to ensure Windows is excluded

---------

Co-authored-by: Cam Hutchison <camh@goteleport.com>
github-merge-queue Bot pushed a commit that referenced this pull request Jun 26, 2025
* Add fork after authentication for tsh ssh (#54696)

This change adds fork after authentication support
to tsh ssh.

* tsh: Add wrapper for syscall.Dup2 for linux/arm64 (#55925)

* tsh: Add wrapper for syscall.Dup2 for linux/arm64

Add a wrapper for `syscall.Dup2()` as linux ARM64 does not have that
syscall. On that platform, `syscall.Dup3()` needs to be used instead.

Fixes: 57c909d

* Implement dup2 with syscall.Dup3 on all linux platforms

* Add explicit "unix" constraint to dup2_unix.go to ensure Windows is excluded

---------

Co-authored-by: Cam Hutchison <camh@goteleport.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog Indicates that a PR does not require a changelog entry size/sm tsh tsh - Teleport's command line tool for logging into nodes running Teleport.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants