Bug 212875 - [patch] add -d (domain) flag to hostname
Summary: [patch] add -d (domain) flag to hostname
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Marcelo Araujo
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2016-09-21 06:58 UTC by Ben RUBSON
Modified: 2016-11-25 05:54 UTC (History)
2 users (show)

See Also:


Attachments
patch to add -d flag to hostname (1.14 KB, patch)
2016-09-21 06:58 UTC, Ben RUBSON
no flags Details | Diff
patch to add -d flag to hostname (1.14 KB, patch)
2016-10-17 13:37 UTC, Ben RUBSON
no flags Details | Diff
patch to add -d flag to hostname (1.48 KB, patch)
2016-10-17 13:44 UTC, Ben RUBSON
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ben RUBSON 2016-09-21 06:58:45 UTC
Created attachment 175028 [details]
patch to add -d flag to hostname

Hello,

Here is a patch to add -d flag to hostname command.
-d prints domain only.

# hostname
server.domain.com
# hostname -s
server
# hostname -d
domain.com

Thank you for merging !

Ben
Comment 1 Kurt Jaeger freebsd_committer freebsd_triage 2016-10-13 18:20:52 UTC
testbuild is OK.

I'm wondering if the command should warn/error if one uses any combination
of flags on the command line and what should take precedence ?
Comment 2 Ben RUBSON 2016-10-17 13:37:33 UTC
Created attachment 175863 [details]
patch to add -d flag to hostname
Comment 3 Ben RUBSON 2016-10-17 13:38:21 UTC
I've just modified the patch according to your last comment Kurt.
Comment 4 Ben RUBSON 2016-10-17 13:44:20 UTC
Created attachment 175866 [details]
patch to add -d flag to hostname
Comment 5 Marcelo Araujo freebsd_committer freebsd_triage 2016-11-07 12:55:54 UTC
I'll take it.
Comment 6 Ben RUBSON 2016-11-08 07:12:23 UTC
Many thanks Marcelo, should then be merged soon :)
Comment 7 commit-hook freebsd_committer freebsd_triage 2016-11-08 11:37:03 UTC
A commit references this bug:

Author: araujo
Date: Tue Nov  8 11:36:33 UTC 2016
New revision: 308443
URL: https://svnweb.freebsd.org/changeset/base/308443

Log:
  Add -d flag that prints domain only.

  PR:		212875
  Submitted by:	Ben RUBSON <ben.rubson@gmail.com>
  Reviewed by:	pi

Changes:
  head/bin/hostname/hostname.1
  head/bin/hostname/hostname.c
Comment 8 Marcelo Araujo freebsd_committer freebsd_triage 2016-11-08 11:38:03 UTC
Thank you guys, for the patch and review.
Comment 9 commit-hook freebsd_committer freebsd_triage 2016-11-25 05:54:45 UTC
A commit references this bug:

Author: araujo
Date: Fri Nov 25 05:54:18 UTC 2016
New revision: 309130
URL: https://svnweb.freebsd.org/changeset/base/309130

Log:
  MFC r308443, r308459, r308462, r308478, r308786

  r308443:
  Add -d flag that prints domain only.

  PR:		212875
  Submitted by:	Ben RUBSON <ben.rubson@gmail.com>
  Reviewed by:	pi

  r308459:
  Fix missing '-' for the flags -s and -d on both manpage and usage.

  Reported by:	garga, bde

  r308462:
  Add flag -B which does the same like batch mode but without exiting after
  print. Also add a new flag -s that add blocks size to statistics.

  PR:		198347, 212726
  Submitted by:	Ben RUBSON <ben.rubson@gmail.com>
  Tested by:	pi
  MFC After:	2 weeks.

  r308478:
  We can't use protect(1) inside a jail(8)!
  To avoid have warning for services that are using oomprotect, oomprotect
  will only be applied on services that won't run inside jails.

  Reported by:	allanjude
  MFC after:	2 weeks.

  r308786:
  rc.subr: Swap checks so we only fork sysctl if *_oomprotect is set.

Changes:
_U  stable/11/
  stable/11/bin/hostname/hostname.1
  stable/11/bin/hostname/hostname.c
  stable/11/etc/rc.subr
  stable/11/usr.sbin/gstat/gstat.8
  stable/11/usr.sbin/gstat/gstat.c