Skip to content

Fix printf octal interpretation error in hostname generation#1566

Merged
brianmcgillion merged 1 commit intotiiuae:mainfrom
vadika:hostname-gen-corner
Nov 17, 2025
Merged

Fix printf octal interpretation error in hostname generation#1566
brianmcgillion merged 1 commit intotiiuae:mainfrom
vadika:hostname-gen-corner

Conversation

@vadika
Copy link
Copy Markdown
Contributor

@vadika vadika commented Nov 17, 2025

When the generated ID starts with 0 (e.g., 0990473387), printf '%x' interprets it as an octal number, causing 'invalid octal number' error since 09 is not valid in octal (only 0-7 digits allowed).

Force base-10 interpretation using $((10#id)) to prevent this corner case.

Description of Changes

Type of Change

  • New Feature
  • Bug Fix
  • Improvement / Refactor

Related Issues / Tickets

Checklist

  • Clear summary in PR description
  • Detailed and meaningful commit message(s)
  • Commits are logically organized and squashed if appropriate
  • Contribution guidelines followed
  • Ghaf documentation updated with the commit - https://tiiuae.github.io/ghaf/
  • Author has run make-checks and it passes
  • All automatic GitHub Action checks pass - see actions
  • Author has added reviewers and removed PR draft status

Testing Instructions

Applicable Targets

  • Orin AGX aarch64
  • Orin NX aarch64
  • Lenovo X1 x86_64
  • Dell Latitude x86_64
  • System 76 x86_64

Installation Method

  • Requires full re-installation
  • Can be updated with nixos-rebuild ... switch
  • Other:

Test Steps To Verify:

  1. ...

When the generated ID starts with 0 (e.g., 0990473387), printf '%x'
interprets it as an octal number, causing 'invalid octal number' error
since 09 is not valid in octal (only 0-7 digits allowed).

Force base-10 interpretation using $((10#$id)) to prevent this corner case.

Signed-off-by: vadik likholetov <vadikas@gmail.com>
@milva-unikie
Copy link
Copy Markdown

I checked from the jenkins-pre-merge pipeline that ghaf-dynamic-hostname.service no longer fails on Orin-NX.

All other targets are working as well.

@milva-unikie milva-unikie added the Tested on Orin NX This PR has been tested on NVIDIA Jetson NX Orin label Nov 17, 2025
@brianmcgillion brianmcgillion merged commit cd20eb7 into tiiuae:main Nov 17, 2025
28 checks passed
@vadika vadika deleted the hostname-gen-corner branch November 24, 2025 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Tested on Orin NX This PR has been tested on NVIDIA Jetson NX Orin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants