Skip to content

fix: can not get hostname in redhat#12267

Merged
Baoyuantop merged 7 commits into
apache:masterfrom
xuruidong:gethostname
Aug 1, 2025
Merged

fix: can not get hostname in redhat#12267
Baoyuantop merged 7 commits into
apache:masterfrom
xuruidong:gethostname

Conversation

@xuruidong

@xuruidong xuruidong commented May 29, 2025

Copy link
Copy Markdown
Contributor

Description

I use docker image apache/apisix:3.11.0-redhat , and get an error from the log: "sh: /bin/hostname: No such file or directory"
image

Which issue(s) this PR fixes:

Fixes #12270

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working labels May 29, 2025
@Baoyuantop

Copy link
Copy Markdown
Contributor

Hi @xuruidong, can you create an issue first and include minimal steps to reproduce it?

@xuruidong

Copy link
Copy Markdown
Contributor Author

Hi @xuruidong, can you create an issue first and include minimal steps to reproduce it?

done

Comment thread apisix/core/utils.lua Outdated
bzp2010
bzp2010 previously approved these changes Jun 9, 2025
Comment thread apisix/core/utils.lua Outdated
Comment thread t/core/utils.t
@bzp2010
bzp2010 self-requested a review June 9, 2025 08:04
@Baoyuantop

Copy link
Copy Markdown
Contributor

Hi @xuruidong, please fix failed ci

@Baoyuantop Baoyuantop left a comment

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.

Merging the master branch can make the failed CI pass.

Comment thread t/core/utils.t Outdated
ngx.say("hostname: ", hostname)
local hostname2 = core.utils.gethostname()
ngx.say("hostname cached: ", hostname == hostname2)
ngx.say("hostname valid: ", hostname ~= "" and (hostname ~= "unknown" or true))

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.

(hostname ~= "unknown" or true) always evaluates to true.

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.

Hi @xuruidong, please have a look.

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.

@Baoyuantop ,please review this. Thank you.

@Baoyuantop Baoyuantop added the wait for update wait for the author's response in this issue/PR label Jul 24, 2025
@Baoyuantop Baoyuantop removed the wait for update wait for the author's response in this issue/PR label Jul 29, 2025
Baoyuantop
Baoyuantop previously approved these changes Jul 31, 2025
membphis
membphis previously approved these changes Jul 31, 2025

@membphis membphis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

Comment thread apisix/core/utils.lua Outdated
@xuruidong
xuruidong dismissed stale reviews from membphis and Baoyuantop via ac6504b August 1, 2025 03:28
@Baoyuantop
Baoyuantop merged commit e90570a into apache:master Aug 1, 2025
26 checks passed
@github-project-automation github-project-automation Bot moved this from 👀 In review to ✅ Done in ⚡️ Apache APISIX Roadmap Aug 1, 2025
jizhuozhi pushed a commit to jizhuozhi/apisix that referenced this pull request Oct 18, 2025
@xuruidong
xuruidong deleted the gethostname branch November 24, 2025 02:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

bug: can not get hostname in redhat

4 participants