[Group.of.nepali.translators] [Bug 1570997] Re: fail if HOME environment variable is not set

2023-05-11 Thread Christian Ehrhardt 
Hi Scott and Dustin, long time no see :-)
I guess none of you bothers about this being fixed in Xenial anymore, let me 
update the assignments and status to reflect that.

** Changed in: ssh-import-id (Ubuntu Xenial)
   Status: Triaged => Won't Fix

** Changed in: ssh-import-id (Ubuntu Xenial)
 Assignee: Scott Moser (smoser) => (unassigned)

** Changed in: ssh-import-id (Ubuntu)
 Assignee: Dustin Kirkland  (kirkland) => (unassigned)

** Changed in: ssh-import-id
 Assignee: Dustin Kirkland  (kirkland) => (unassigned)

-- 
You received this bug notification because you are a member of नेपाली
भाषा समायोजकहरुको समूह, which is subscribed to Xenial.
Matching subscriptions: Ubuntu 16.04 Bugs
https://bugs.launchpad.net/bugs/1570997

Title:
  fail if HOME environment variable is not set

Status in ssh-import-id:
  Fix Released
Status in ssh-import-id package in Ubuntu:
  Fix Released
Status in ssh-import-id source package in Xenial:
  Won't Fix
Status in ssh-import-id source package in Bionic:
  Fix Released

Bug description:
  === Begin SRU Template ===
  [Impact]
  Running ssh-import-id without environment variable HOME set
  will fail and print an error message like:

   TypeError: join() argument must be str or bytes, not 'NoneType'

  [Test Case]
  $ name="my-x"
  $ ud=$(printf '%s\n%s\n' '#!/bin/sh' 'ssh-import-id smoser')
  $ lxc launch ubuntu-daily:xenial "$name" "--config=user.user-data=$ud"

  To see failure, you can then just:
  $ lxc exec "$name" -- cat /run/cloud-init/result.json
  {
   "v1": {
    "datasource": "DataSourceHetzner",
    "errors": [
     "('scripts-user', RuntimeError('Runparts: 1 failures in 1 attempted 
commands',))"
    ]
   }
  }

  $ lxc exec "$name" -- grep "ssh-import-id lp:smoser" 
/root/.ssh/authorized_keys &&
  echo GOOD || echo FAIL

  [Regression Potential]
  Regression is unlikely.  The code only does anything if HOME is not present.
  This has been in Artful and Bionic since 2016-09-16.

  [Other Info]
  Upstream merge proposal:
   
https://code.launchpad.net/~smoser/ssh-import-id/trunk.lp1570997/+merge/326692

  === End SRU Template ===

  I've modified /usr/bin/ssh-import-id to show a stack trace rather than 
unhelpful message:
   TypeError: join() argument must be str or bytes, not 'NoneType'

  Then, running:
  $ env -u HOME ssh-import-id smoser
  Traceback (most recent call last):
    File "/usr/bin/ssh-import-id", line 62, in 
  main()
    File "/usr/bin/ssh-import-id", line 45, in main
  k = import_keys(proto, username, parser.options.useragent)
    File "/usr/lib/python3/dist-packages/ssh_import_id/__init__.py", line 204, 
in import_keys
  local_keys = key_list(read_keyfile())
    File "/usr/lib/python3/dist-packages/ssh_import_id/__init__.py", line 135, 
in read_keyfile
  output_file = parser.options.output or os.path.join(os.getenv("HOME"), 
".ssh", "authorized_keys")
    File "/usr/lib/python3.5/posixpath.py", line 89, in join
  genericpath._check_arg_types('join', a, *p)
    File "/usr/lib/python3.5/genericpath.py", line 143, in _check_arg_types
  (funcname, s.__class__.__name__)) from None
  TypeError: join() argument must be str or bytes, not 'NoneType'

  I came to find this by trying to  launch an instance with:

  $ ec2metadata --user-data
  #!/bin/sh
  exec >/my.log 2>&1
  cat /proc/uptime
  date -R
  ssh-import-id smoser

  The basic issue is that the environment that cloud-init runs in does
  not have HOME set.

  I suggest using os.path.expanduser
  def authorized_key_file():
  return os.path.join(os.path.expanduser("~"), ".ssh", 
"authorized_keys")

  ProblemType: Bug
  DistroRelease: Ubuntu 16.04
  Package: ssh-import-id 5.5-0ubuntu1 [modified: usr/bin/ssh-import-id]
  ProcVersionSignature: User Name 4.4.0-18.34-generic 4.4.6
  Uname: Linux 4.4.0-18-generic x86_64
  ApportVersion: 2.20.1-0ubuntu1
  Architecture: amd64
  Date: Fri Apr 15 17:36:09 2016
  Ec2AMI: ami-929f8cf8
  Ec2AMIManifest: 
ubuntu-us-east-1/images-testing/hvm-instance/ubuntu-xenial-daily-amd64-server-20160412.manifest.xml
  Ec2AvailabilityZone: us-east-1c
  Ec2InstanceType: m3.medium
  Ec2Kernel: unavailable
  Ec2Ramdisk: unavailable
  PackageArchitecture: all
  ProcEnviron:
   TERM=xterm-256color
   PATH=(custom, no user)
   XDG_RUNTIME_DIR=
   LANG=en_US.UTF-8
   SHELL=/bin/bash
  SourcePackage: ssh-import-id
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ssh-import-id/+bug/1570997/+subscriptions


___
Mailing list: https://launchpad.net/~group.of.nepali.translators
Post to : group.of.nepali.translators@lists.launchpad.net
Unsubscribe : https://launchpad.net/~group.of.nepali.translators
More help   : https://help.launchpad.net/ListHelp


[Group.of.nepali.translators] [Bug 1570997] Re: fail if HOME environment variable is not set

2018-05-24 Thread Launchpad Bug Tracker
This bug was fixed in the package ssh-import-id - 5.7-0ubuntu1.1

---
ssh-import-id (5.7-0ubuntu1.1) bionic; urgency=medium

  * Convert source foramt to "3.0 (quilt)", implicitly removing
ssh_import_id.egg-info presumably included in last upload by
mistake.
  * Backport some fixes from cosmic:
- d/patches/0001-lp-1770302-output-flushing.patch: Ensure error
  messages in fetch_keys_gh get flushed by replacing calls to print
  with calls to die and calls to os._exit() with calls to sys.exit.
  (LP: #1770302)
- d/patches/0002-lp-1770503-launchpad-error-checking.patch: Check
  status code of response when fetching ssh keys from Launchpad.
  (LP: #1770305)
- d/patches/0003-lp-1570997-find-keys-no-HOME.patch: Get path to
  user's authorized_keys even if HOME is not set.  (LP: #1570997)

 -- Michael Hudson-Doyle   Thu, 17 May 2018
11:40:43 +1200

** Changed in: ssh-import-id (Ubuntu Bionic)
   Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of नेपाली
भाषा समायोजकहरुको समूह, which is subscribed to Xenial.
Matching subscriptions: Ubuntu 16.04 Bugs
https://bugs.launchpad.net/bugs/1570997

Title:
  fail if HOME environment variable is not set

Status in ssh-import-id:
  Fix Released
Status in ssh-import-id package in Ubuntu:
  Fix Released
Status in ssh-import-id source package in Xenial:
  Triaged
Status in ssh-import-id source package in Bionic:
  Fix Released

Bug description:
  === Begin SRU Template ===
  [Impact]
  Running ssh-import-id without environment variable HOME set
  will fail and print an error message like:

   TypeError: join() argument must be str or bytes, not 'NoneType'

  [Test Case]
  $ name="my-x"
  $ ud=$(printf '%s\n%s\n' '#!/bin/sh' 'ssh-import-id smoser')
  $ lxc launch ubuntu-daily:xenial "$name" "--config=user.user-data=$ud"

  To see failure, you can then just:
  $ lxc exec "$name" -- cat /run/cloud-init/result.json
  {
   "v1": {
    "datasource": "DataSourceHetzner",
    "errors": [
     "('scripts-user', RuntimeError('Runparts: 1 failures in 1 attempted 
commands',))"
    ]
   }
  }

  $ lxc exec "$name" -- grep "ssh-import-id lp:smoser" 
/root/.ssh/authorized_keys &&
  echo GOOD || echo FAIL

  [Regression Potential]
  Regression is unlikely.  The code only does anything if HOME is not present.
  This has been in Artful and Bionic since 2016-09-16.

  [Other Info]
  Upstream merge proposal:
   
https://code.launchpad.net/~smoser/ssh-import-id/trunk.lp1570997/+merge/326692

  === End SRU Template ===

  I've modified /usr/bin/ssh-import-id to show a stack trace rather than 
unhelpful message:
   TypeError: join() argument must be str or bytes, not 'NoneType'

  Then, running:
  $ env -u HOME ssh-import-id smoser
  Traceback (most recent call last):
    File "/usr/bin/ssh-import-id", line 62, in 
  main()
    File "/usr/bin/ssh-import-id", line 45, in main
  k = import_keys(proto, username, parser.options.useragent)
    File "/usr/lib/python3/dist-packages/ssh_import_id/__init__.py", line 204, 
in import_keys
  local_keys = key_list(read_keyfile())
    File "/usr/lib/python3/dist-packages/ssh_import_id/__init__.py", line 135, 
in read_keyfile
  output_file = parser.options.output or os.path.join(os.getenv("HOME"), 
".ssh", "authorized_keys")
    File "/usr/lib/python3.5/posixpath.py", line 89, in join
  genericpath._check_arg_types('join', a, *p)
    File "/usr/lib/python3.5/genericpath.py", line 143, in _check_arg_types
  (funcname, s.__class__.__name__)) from None
  TypeError: join() argument must be str or bytes, not 'NoneType'

  I came to find this by trying to  launch an instance with:

  $ ec2metadata --user-data
  #!/bin/sh
  exec >/my.log 2>&1
  cat /proc/uptime
  date -R
  ssh-import-id smoser

  The basic issue is that the environment that cloud-init runs in does
  not have HOME set.

  I suggest using os.path.expanduser
  def authorized_key_file():
  return os.path.join(os.path.expanduser("~"), ".ssh", 
"authorized_keys")

  ProblemType: Bug
  DistroRelease: Ubuntu 16.04
  Package: ssh-import-id 5.5-0ubuntu1 [modified: usr/bin/ssh-import-id]
  ProcVersionSignature: User Name 4.4.0-18.34-generic 4.4.6
  Uname: Linux 4.4.0-18-generic x86_64
  ApportVersion: 2.20.1-0ubuntu1
  Architecture: amd64
  Date: Fri Apr 15 17:36:09 2016
  Ec2AMI: ami-929f8cf8
  Ec2AMIManifest: 
ubuntu-us-east-1/images-testing/hvm-instance/ubuntu-xenial-daily-amd64-server-20160412.manifest.xml
  Ec2AvailabilityZone: us-east-1c
  Ec2InstanceType: m3.medium
  Ec2Kernel: unavailable
  Ec2Ramdisk: unavailable
  PackageArchitecture: all
  ProcEnviron:
   TERM=xterm-256color
   PATH=(custom, no user)
   XDG_RUNTIME_DIR=
   LANG=en_US.UTF-8
   SHELL=/bin/bash
  SourcePackage: ssh-import-id
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:

[Group.of.nepali.translators] [Bug 1570997] Re: fail if HOME environment variable is not set

2018-05-16 Thread Michael Hudson-Doyle
** Also affects: ssh-import-id (Ubuntu Bionic)
   Importance: Undecided
   Status: New

-- 
You received this bug notification because you are a member of नेपाली
भाषा समायोजकहरुको समूह, which is subscribed to Xenial.
Matching subscriptions: Ubuntu 16.04 Bugs
https://bugs.launchpad.net/bugs/1570997

Title:
  fail if HOME environment variable is not set

Status in ssh-import-id:
  Fix Released
Status in ssh-import-id package in Ubuntu:
  Fix Released
Status in ssh-import-id source package in Xenial:
  Fix Committed
Status in ssh-import-id source package in Bionic:
  New

Bug description:
  === Begin SRU Template ===
  [Impact] 
  Running ssh-import-id without environment variable HOME set
  will fail and print an error message like:

   TypeError: join() argument must be str or bytes, not 'NoneType'

  [Test Case]
  $ name="my-x"
  $ ud=$(printf '%s\n%s\n' '#!/bin/sh' 'ssh-import-id smoser')
  $ lxc launch ubuntu-daily:xenial "$name" "--config=user.user-data=$ud"

  To see failure, you can then just:
  $ lxc exec "$name" -- cat /run/cloud-init/result.json
  {
   "v1": {
"datasource": "DataSourceHetzner",
"errors": [
 "('scripts-user', RuntimeError('Runparts: 1 failures in 1 attempted 
commands',))"
]
   }
  }

  $ lxc exec "$name" -- grep "ssh-import-id smoser" /root/.ssh/authorized_keys 
&&
  echo GOOD || echo FAIL

  [Regression Potential] 
  Regression is unlikely.  The code only does anything if HOME is not present.
  This has been in Artful and Bionic since 2016-09-16.

  [Other Info]
  Upstream merge proposal:
   
https://code.launchpad.net/~smoser/ssh-import-id/trunk.lp1570997/+merge/326692

  === End SRU Template ===

  I've modified /usr/bin/ssh-import-id to show a stack trace rather than 
unhelpful message:
   TypeError: join() argument must be str or bytes, not 'NoneType'

  Then, running:
  $ env -u HOME ssh-import-id smoser
  Traceback (most recent call last):
    File "/usr/bin/ssh-import-id", line 62, in 
  main()
    File "/usr/bin/ssh-import-id", line 45, in main
  k = import_keys(proto, username, parser.options.useragent)
    File "/usr/lib/python3/dist-packages/ssh_import_id/__init__.py", line 204, 
in import_keys
  local_keys = key_list(read_keyfile())
    File "/usr/lib/python3/dist-packages/ssh_import_id/__init__.py", line 135, 
in read_keyfile
  output_file = parser.options.output or os.path.join(os.getenv("HOME"), 
".ssh", "authorized_keys")
    File "/usr/lib/python3.5/posixpath.py", line 89, in join
  genericpath._check_arg_types('join', a, *p)
    File "/usr/lib/python3.5/genericpath.py", line 143, in _check_arg_types
  (funcname, s.__class__.__name__)) from None
  TypeError: join() argument must be str or bytes, not 'NoneType'

  I came to find this by trying to  launch an instance with:

  $ ec2metadata --user-data
  #!/bin/sh
  exec >/my.log 2>&1
  cat /proc/uptime
  date -R
  ssh-import-id smoser

  The basic issue is that the environment that cloud-init runs in does
  not have HOME set.

  I suggest using os.path.expanduser
  def authorized_key_file():
  return os.path.join(os.path.expanduser("~"), ".ssh", 
"authorized_keys")

  ProblemType: Bug
  DistroRelease: Ubuntu 16.04
  Package: ssh-import-id 5.5-0ubuntu1 [modified: usr/bin/ssh-import-id]
  ProcVersionSignature: User Name 4.4.0-18.34-generic 4.4.6
  Uname: Linux 4.4.0-18-generic x86_64
  ApportVersion: 2.20.1-0ubuntu1
  Architecture: amd64
  Date: Fri Apr 15 17:36:09 2016
  Ec2AMI: ami-929f8cf8
  Ec2AMIManifest: 
ubuntu-us-east-1/images-testing/hvm-instance/ubuntu-xenial-daily-amd64-server-20160412.manifest.xml
  Ec2AvailabilityZone: us-east-1c
  Ec2InstanceType: m3.medium
  Ec2Kernel: unavailable
  Ec2Ramdisk: unavailable
  PackageArchitecture: all
  ProcEnviron:
   TERM=xterm-256color
   PATH=(custom, no user)
   XDG_RUNTIME_DIR=
   LANG=en_US.UTF-8
   SHELL=/bin/bash
  SourcePackage: ssh-import-id
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ssh-import-id/+bug/1570997/+subscriptions

___
Mailing list: https://launchpad.net/~group.of.nepali.translators
Post to : group.of.nepali.translators@lists.launchpad.net
Unsubscribe : https://launchpad.net/~group.of.nepali.translators
More help   : https://help.launchpad.net/ListHelp


[Group.of.nepali.translators] [Bug 1570997] Re: fail if HOME environment variable is not set

2018-04-05 Thread Brian Murray
Hello Scott, or anyone else affected,

Accepted ssh-import-id into xenial-proposed. The package will build now
and be available at https://launchpad.net/ubuntu/+source/ssh-import-
id/5.5-0ubuntu1.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package.  See
https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how
to enable and use -proposed.Your feedback will aid us getting this
update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug,
mentioning the version of the package you tested and change the tag from
verification-needed-xenial to verification-done-xenial. If it does not
fix the bug for you, please add a comment stating that, and change the
tag to verification-failed-xenial. In either case, without details of
your testing we will not be able to proceed.

Further information regarding the verification process can be found at
https://wiki.ubuntu.com/QATeam/PerformingSRUVerification .  Thank you in
advance!

** Changed in: ssh-import-id (Ubuntu Xenial)
   Status: Fix Released => Fix Committed

** Tags added: verification-needed verification-needed-xenial

-- 
You received this bug notification because you are a member of नेपाली
भाषा समायोजकहरुको समूह, which is subscribed to Xenial.
Matching subscriptions: Ubuntu 16.04 Bugs
https://bugs.launchpad.net/bugs/1570997

Title:
  fail if HOME environment variable is not set

Status in ssh-import-id:
  Fix Released
Status in ssh-import-id package in Ubuntu:
  Fix Released
Status in ssh-import-id source package in Xenial:
  Fix Committed

Bug description:
  === Begin SRU Template ===
  [Impact] 
  Running ssh-import-id without environment variable HOME set
  will fail and print an error message like:

   TypeError: join() argument must be str or bytes, not 'NoneType'

  [Test Case]
  $ name="my-x"
  $ ud=$(printf '%s\n%s\n' '#!/bin/sh' 'ssh-import-id smoser')
  $ lxc launch ubuntu-daily:xenial "$name" "--config=user.user-data=$ud"

  To see failure, you can then just:
  $ lxc exec "$name" -- cat /run/cloud-init/result.json
  {
   "v1": {
"datasource": "DataSourceHetzner",
"errors": [
 "('scripts-user', RuntimeError('Runparts: 1 failures in 1 attempted 
commands',))"
]
   }
  }

  $ lxc exec "$name" -- grep "ssh-import-id smoser" /root/.ssh/authorized_keys 
&&
  echo GOOD || echo FAIL

  [Regression Potential] 
  Regression is unlikely.  The code only does anything if HOME is not present.
  This has been in Artful and Bionic since 2016-09-16.

  [Other Info]
  Upstream merge proposal:
   
https://code.launchpad.net/~smoser/ssh-import-id/trunk.lp1570997/+merge/326692

  === End SRU Template ===

  I've modified /usr/bin/ssh-import-id to show a stack trace rather than 
unhelpful message:
   TypeError: join() argument must be str or bytes, not 'NoneType'

  Then, running:
  $ env -u HOME ssh-import-id smoser
  Traceback (most recent call last):
    File "/usr/bin/ssh-import-id", line 62, in 
  main()
    File "/usr/bin/ssh-import-id", line 45, in main
  k = import_keys(proto, username, parser.options.useragent)
    File "/usr/lib/python3/dist-packages/ssh_import_id/__init__.py", line 204, 
in import_keys
  local_keys = key_list(read_keyfile())
    File "/usr/lib/python3/dist-packages/ssh_import_id/__init__.py", line 135, 
in read_keyfile
  output_file = parser.options.output or os.path.join(os.getenv("HOME"), 
".ssh", "authorized_keys")
    File "/usr/lib/python3.5/posixpath.py", line 89, in join
  genericpath._check_arg_types('join', a, *p)
    File "/usr/lib/python3.5/genericpath.py", line 143, in _check_arg_types
  (funcname, s.__class__.__name__)) from None
  TypeError: join() argument must be str or bytes, not 'NoneType'

  I came to find this by trying to  launch an instance with:

  $ ec2metadata --user-data
  #!/bin/sh
  exec >/my.log 2>&1
  cat /proc/uptime
  date -R
  ssh-import-id smoser

  The basic issue is that the environment that cloud-init runs in does
  not have HOME set.

  I suggest using os.path.expanduser
  def authorized_key_file():
  return os.path.join(os.path.expanduser("~"), ".ssh", 
"authorized_keys")

  ProblemType: Bug
  DistroRelease: Ubuntu 16.04
  Package: ssh-import-id 5.5-0ubuntu1 [modified: usr/bin/ssh-import-id]
  ProcVersionSignature: User Name 4.4.0-18.34-generic 4.4.6
  Uname: Linux 4.4.0-18-generic x86_64
  ApportVersion: 2.20.1-0ubuntu1
  Architecture: amd64
  Date: Fri Apr 15 17:36:09 2016
  Ec2AMI: ami-929f8cf8
  Ec2AMIManifest: 
ubuntu-us-east-1/images-testing/hvm-instance/ubuntu-xenial-daily-amd64-server-20160412.manifest.xml
  Ec2AvailabilityZone: us-east-1c
  Ec2InstanceType: m3.medium
  Ec2Kernel: unavailable
  Ec2Ramdisk: unavailable
  PackageArchitecture: all
  ProcEnviron:
   TERM=xterm-256color
   PATH=(custom, no user)
   XDG_RUNTIME_DIR=
   LANG=en_US.UTF-8
   SHELL=/bin/bash
  SourcePackage: ssh-import-id
  UpgradeStatus: No upgrade log present 

[Group.of.nepali.translators] [Bug 1570997] Re: fail if HOME environment variable is not set

2018-04-01 Thread touny
** Changed in: ssh-import-id
   Status: Fix Committed => Confirmed

** Changed in: ssh-import-id
   Status: Confirmed => Incomplete

** Changed in: ssh-import-id
   Status: Incomplete => Fix Released

** Changed in: ssh-import-id (Ubuntu Xenial)
   Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of नेपाली
भाषा समायोजकहरुको समूह, which is subscribed to Xenial.
Matching subscriptions: Ubuntu 16.04 Bugs
https://bugs.launchpad.net/bugs/1570997

Title:
  fail if HOME environment variable is not set

Status in ssh-import-id:
  Fix Released
Status in ssh-import-id package in Ubuntu:
  Fix Released
Status in ssh-import-id source package in Xenial:
  Fix Released

Bug description:
  === Begin SRU Template ===
  [Impact] 
  Running ssh-import-id without environment variable HOME set
  will fail and print an error message like:

   TypeError: join() argument must be str or bytes, not 'NoneType'

  [Test Case]
  $ name="my-x"
  $ ud=$(printf '%s\n%s\n' '#!/bin/sh' 'ssh-import-id smoser')
  $ lxc launch ubuntu-daily:xenial "$name" "--config=user.user-data=$ud"

  To see failure, you can then just:
  $ lxc exec "$name" -- cat /run/cloud-init/result.json
  {
   "v1": {
"datasource": "DataSourceHetzner",
"errors": [
 "('scripts-user', RuntimeError('Runparts: 1 failures in 1 attempted 
commands',))"
]
   }
  }

  $ lxc exec "$name" -- grep "ssh-import-id smoser" /root/.ssh/authorized_keys 
&&
  echo GOOD || echo FAIL

  [Regression Potential] 
  Regression is unlikely.  The code only does anything if HOME is not present.
  This has been in Artful and Bionic since 2016-09-16.

  [Other Info]
  Upstream merge proposal:
   
https://code.launchpad.net/~smoser/ssh-import-id/trunk.lp1570997/+merge/326692

  === End SRU Template ===

  I've modified /usr/bin/ssh-import-id to show a stack trace rather than 
unhelpful message:
   TypeError: join() argument must be str or bytes, not 'NoneType'

  Then, running:
  $ env -u HOME ssh-import-id smoser
  Traceback (most recent call last):
    File "/usr/bin/ssh-import-id", line 62, in 
  main()
    File "/usr/bin/ssh-import-id", line 45, in main
  k = import_keys(proto, username, parser.options.useragent)
    File "/usr/lib/python3/dist-packages/ssh_import_id/__init__.py", line 204, 
in import_keys
  local_keys = key_list(read_keyfile())
    File "/usr/lib/python3/dist-packages/ssh_import_id/__init__.py", line 135, 
in read_keyfile
  output_file = parser.options.output or os.path.join(os.getenv("HOME"), 
".ssh", "authorized_keys")
    File "/usr/lib/python3.5/posixpath.py", line 89, in join
  genericpath._check_arg_types('join', a, *p)
    File "/usr/lib/python3.5/genericpath.py", line 143, in _check_arg_types
  (funcname, s.__class__.__name__)) from None
  TypeError: join() argument must be str or bytes, not 'NoneType'

  I came to find this by trying to  launch an instance with:

  $ ec2metadata --user-data
  #!/bin/sh
  exec >/my.log 2>&1
  cat /proc/uptime
  date -R
  ssh-import-id smoser

  The basic issue is that the environment that cloud-init runs in does
  not have HOME set.

  I suggest using os.path.expanduser
  def authorized_key_file():
  return os.path.join(os.path.expanduser("~"), ".ssh", 
"authorized_keys")

  ProblemType: Bug
  DistroRelease: Ubuntu 16.04
  Package: ssh-import-id 5.5-0ubuntu1 [modified: usr/bin/ssh-import-id]
  ProcVersionSignature: User Name 4.4.0-18.34-generic 4.4.6
  Uname: Linux 4.4.0-18-generic x86_64
  ApportVersion: 2.20.1-0ubuntu1
  Architecture: amd64
  Date: Fri Apr 15 17:36:09 2016
  Ec2AMI: ami-929f8cf8
  Ec2AMIManifest: 
ubuntu-us-east-1/images-testing/hvm-instance/ubuntu-xenial-daily-amd64-server-20160412.manifest.xml
  Ec2AvailabilityZone: us-east-1c
  Ec2InstanceType: m3.medium
  Ec2Kernel: unavailable
  Ec2Ramdisk: unavailable
  PackageArchitecture: all
  ProcEnviron:
   TERM=xterm-256color
   PATH=(custom, no user)
   XDG_RUNTIME_DIR=
   LANG=en_US.UTF-8
   SHELL=/bin/bash
  SourcePackage: ssh-import-id
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ssh-import-id/+bug/1570997/+subscriptions

___
Mailing list: https://launchpad.net/~group.of.nepali.translators
Post to : group.of.nepali.translators@lists.launchpad.net
Unsubscribe : https://launchpad.net/~group.of.nepali.translators
More help   : https://help.launchpad.net/ListHelp


[Group.of.nepali.translators] [Bug 1570997] Re: fail if HOME environment variable is not set

2018-03-27 Thread Scott Moser
** Also affects: ssh-import-id (Ubuntu Xenial)
   Importance: Undecided
   Status: New

-- 
You received this bug notification because you are a member of नेपाली
भाषा समायोजकहरुको समूह, which is subscribed to Xenial.
Matching subscriptions: Ubuntu 16.04 Bugs
https://bugs.launchpad.net/bugs/1570997

Title:
  fail if HOME environment variable is not set

Status in ssh-import-id:
  Fix Committed
Status in ssh-import-id package in Ubuntu:
  Fix Released
Status in ssh-import-id source package in Xenial:
  New

Bug description:
  === Begin SRU Template ===
  [Impact] 
  Running ssh-import-id without environment variable HOME set
  will fail and print an error message like:

   TypeError: join() argument must be str or bytes, not 'NoneType'

  [Test Case]
  $ name="my-x"
  $ ud=$(printf '%s\n%s\n' '#!/bin/sh' 'ssh-import-id smoser')
  $ lxc launch ubuntu-daily:xenial "$name" "--config=user.user-data=$ud"

  To see failure, you can then just:
  $ lxc exec "$name" -- cat /run/cloud-init/result.json
  {
   "v1": {
"datasource": "DataSourceHetzner",
"errors": [
 "('scripts-user', RuntimeError('Runparts: 1 failures in 1 attempted 
commands',))"
]
   }
  }

  $ lxc exec "$name" -- grep "ssh-import-id smoser" /root/.ssh/authorized_keys 
&&
  echo GOOD || echo FAIL

  [Regression Potential] 
  Regression is unlikely.  The code only does anything if HOME is not present.
  This has been in Artful and Bionic since 2016-09-16.

  [Other Info]
  Upstream merge proposal:
   
https://code.launchpad.net/~smoser/ssh-import-id/trunk.lp1570997/+merge/326692

  === End SRU Template ===

  I've modified /usr/bin/ssh-import-id to show a stack trace rather than 
unhelpful message:
   TypeError: join() argument must be str or bytes, not 'NoneType'

  Then, running:
  $ env -u HOME ssh-import-id smoser
  Traceback (most recent call last):
    File "/usr/bin/ssh-import-id", line 62, in 
  main()
    File "/usr/bin/ssh-import-id", line 45, in main
  k = import_keys(proto, username, parser.options.useragent)
    File "/usr/lib/python3/dist-packages/ssh_import_id/__init__.py", line 204, 
in import_keys
  local_keys = key_list(read_keyfile())
    File "/usr/lib/python3/dist-packages/ssh_import_id/__init__.py", line 135, 
in read_keyfile
  output_file = parser.options.output or os.path.join(os.getenv("HOME"), 
".ssh", "authorized_keys")
    File "/usr/lib/python3.5/posixpath.py", line 89, in join
  genericpath._check_arg_types('join', a, *p)
    File "/usr/lib/python3.5/genericpath.py", line 143, in _check_arg_types
  (funcname, s.__class__.__name__)) from None
  TypeError: join() argument must be str or bytes, not 'NoneType'

  I came to find this by trying to  launch an instance with:

  $ ec2metadata --user-data
  #!/bin/sh
  exec >/my.log 2>&1
  cat /proc/uptime
  date -R
  ssh-import-id smoser

  The basic issue is that the environment that cloud-init runs in does
  not have HOME set.

  I suggest using os.path.expanduser
  def authorized_key_file():
  return os.path.join(os.path.expanduser("~"), ".ssh", 
"authorized_keys")

  ProblemType: Bug
  DistroRelease: Ubuntu 16.04
  Package: ssh-import-id 5.5-0ubuntu1 [modified: usr/bin/ssh-import-id]
  ProcVersionSignature: User Name 4.4.0-18.34-generic 4.4.6
  Uname: Linux 4.4.0-18-generic x86_64
  ApportVersion: 2.20.1-0ubuntu1
  Architecture: amd64
  Date: Fri Apr 15 17:36:09 2016
  Ec2AMI: ami-929f8cf8
  Ec2AMIManifest: 
ubuntu-us-east-1/images-testing/hvm-instance/ubuntu-xenial-daily-amd64-server-20160412.manifest.xml
  Ec2AvailabilityZone: us-east-1c
  Ec2InstanceType: m3.medium
  Ec2Kernel: unavailable
  Ec2Ramdisk: unavailable
  PackageArchitecture: all
  ProcEnviron:
   TERM=xterm-256color
   PATH=(custom, no user)
   XDG_RUNTIME_DIR=
   LANG=en_US.UTF-8
   SHELL=/bin/bash
  SourcePackage: ssh-import-id
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ssh-import-id/+bug/1570997/+subscriptions

___
Mailing list: https://launchpad.net/~group.of.nepali.translators
Post to : group.of.nepali.translators@lists.launchpad.net
Unsubscribe : https://launchpad.net/~group.of.nepali.translators
More help   : https://help.launchpad.net/ListHelp