LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 03-27-2019, 09:31 AM   #1
alan_ri (2.0)
LQ Newbie
 
Registered: Mar 2019
Location: Croatia
Distribution: Debian GNU/Linux
Posts: 6

Rep: Reputation: 0
adduser shell script error


Yea, I'm on Slackware now, don't ask, long story.

Anyhow, it seems like the script doesn't like invalid and/or unsupported characters, cause when I was filling in some info about the new user it didn't work out and it kindly went to the next step of the configuration. So when the user was logged in none of the configuration info I have set in that particular step of the configuration were not preserved even though some info I have set in some of the steps of that particular step of the configuration did not have any invalid and/or unsupported characters.

The question is, is there a list of invalid and/or unsupported characters for this particular script and will it be rewritten so that it gives you an option to fix the info you want to fill in if the characters are invalid and/or unsupported?

Sincerely,

Alan
 
Old 03-27-2019, 10:18 AM   #2
orbea
Senior Member
 
Registered: Feb 2015
Distribution: Slackware64-current
Posts: 1,713

Rep: Reputation: Disabled
Would you mind spelling out how to reproduce this and share the complete output with errors?
 
Old 03-27-2019, 11:09 AM   #3
drmozes
Slackware Contributor
 
Registered: Apr 2008
Location: Surrey, England
Distribution: Slackware
Posts: 841

Rep: Reputation: 633Reputation: 633Reputation: 633Reputation: 633Reputation: 633Reputation: 633
Quote:
Originally Posted by orbea View Post
Would you mind spelling out how to reproduce this and share the complete output with errors?
Yep. It uses bash's 'read' builtin, and uses the 'readline' library. If you do the following, you'll see the same issue.

Code:
read -e foo ; echo $foo
I'm not really sure what I could do to change that, but I'll see what input you're providing first.
 
Old 03-27-2019, 11:28 AM   #4
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: FreeBSD/Slackware-14.2+/ArcoLinux
Posts: 9,004

Rep: Reputation: 1884Reputation: 1884Reputation: 1884Reputation: 1884Reputation: 1884Reputation: 1884Reputation: 1884Reputation: 1884Reputation: 1884Reputation: 1884Reputation: 1884
if you go into /usr/sbin you'll find adduser. it is a script. check it out, and you'll see how it's working. maybe give you a lead. Perhaps even you could add a fix to elevate your situation for when you add invalid and/or unsupported characters, it rejects it.

Last edited by BW-userx; 03-27-2019 at 11:34 AM.
 
Old 03-27-2019, 11:33 AM   #5
drmozes
Slackware Contributor
 
Registered: Apr 2008
Location: Surrey, England
Distribution: Slackware
Posts: 841

Rep: Reputation: 633Reputation: 633Reputation: 633Reputation: 633Reputation: 633Reputation: 633
Quote:
Originally Posted by BW-userx View Post
if you go into /usr/sbin you'll find adduser. it is a script. check it out, and you'll see how it's working. maybe give you a lead. Perhaps even you could add a fix to elevate your situation.
I know. I wrote it. If I know what data it's being fed, I might have an idea about it.
 
1 members found this post helpful.
Old 03-27-2019, 12:38 PM   #6
orbea
Senior Member
 
Registered: Feb 2015
Distribution: Slackware64-current
Posts: 1,713

Rep: Reputation: Disabled
I assume this is the relevant function?

Code:
# Function to read keyboard input.
# bash1 is broken (even ash will take read -ep!), so we work around
# it (even though bash1 is no longer supported on Slackware).
function get_input() { 
  local output
  if [ "`echo $BASH_VERSION | cut -b1`" = "1" ]; then
    echo -n "${1} " >&2 # fudge for use with bash v1
    read output
  else # this should work with any other /bin/sh
    read -ep "${1} " output
  fi
  echo $output
}
As you said its hard to help without knowing what the invalid input is and also seeing the actual point of failure, is it failing with read or somewhere else?

Also as a side point that comment is not correct, neither Slackware's ash or dash have "read -e". Fwiw here is the posix spec for read.

https://pubs.opengroup.org/onlinepub...ties/read.html
 
Old 03-27-2019, 02:34 PM   #7
alan_ri (2.0)
LQ Newbie
 
Registered: Mar 2019
Location: Croatia
Distribution: Debian GNU/Linux
Posts: 6

Original Poster
Rep: Reputation: 0
Thanks for the replies so far, folks!

Well, to answer some questions; as for the input it was as simple as typing an email address under "Other" when I was to type in user's full name, work phone, etc. It was something like this:
Code:
email: somebody@protonmail.com
I hit Enter and boom, error and of to the next step of adding the user we go. After finishing the rest of the configuration and logging in as the user nothing was preserved from that step of the configuration when error occurred as far as I could tell at the moment. I cannot reproduce the error now but if you follow my steps you should see it.

@BW-userx Yea, I could probably fix it, but maybe this would be good for Slackware if it is by default.

Last edited by alan_ri (2.0); 03-27-2019 at 02:41 PM.
 
Old 03-27-2019, 02:50 PM   #8
drmozes
Slackware Contributor
 
Registered: Apr 2008
Location: Surrey, England
Distribution: Slackware
Posts: 841

Rep: Reputation: 633Reputation: 633Reputation: 633Reputation: 633Reputation: 633Reputation: 633
Quote:
Originally Posted by alan_ri (2.0) View Post
Thanks for the replies so far, folks!

Well, to answer some questions; as for the input it was as simple as typing an email address under "Other" when I was to type in user's full name, work phone, etc. It was something like this:
Code:
email: somebody@protonmail.com
I hit Enter and boom, error and of to the next step of adding the user we go. After finishing the rest of the configuration and logging in as the user nothing was preserved from that step of the configuration when error occurred as far as I could tell at the moment. I cannot reproduce the error now but if you follow my steps you should see it.

@BW-userx Yea, I could probably fix it, but maybe this would be good for Slackware if it is by default.
There's no issue using an email address here. Also, the input at that point is to the 'useradd' binary.
I don't know what's going on there.
 
Old 03-27-2019, 02:53 PM   #9
alan_ri (2.0)
LQ Newbie
 
Registered: Mar 2019
Location: Croatia
Distribution: Debian GNU/Linux
Posts: 6

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by drmozes View Post
There's no issue using an email address here. Also, the input at that point is to the 'useradd' binary.
I don't know what's going on there.
Did you try to reproduce the error with the exact input not just with the email address?
 
Old 03-27-2019, 03:01 PM   #10
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: FreeBSD/Slackware-14.2+/ArcoLinux
Posts: 9,004

Rep: Reputation: 1884Reputation: 1884Reputation: 1884Reputation: 1884Reputation: 1884Reputation: 1884Reputation: 1884Reputation: 1884Reputation: 1884Reputation: 1884Reputation: 1884
Quote:
Originally Posted by alan_ri (2.0) View Post
Thanks for the replies so far, folks!

Well, to answer some questions; as for the input it was as simple as typing an email address under "Other" when I was to type in user's full name, work phone, etc. It was something like this:
Code:
email: somebody@protonmail.com
I hit Enter and boom, error and of to the next step of adding the user we go. After finishing the rest of the configuration and logging in as the user nothing was preserved from that step of the configuration when error occurred as far as I could tell at the moment. I cannot reproduce the error now but if you follow my steps you should see it.

@BW-userx Yea, I could probably fix it, but maybe this would be good for Slackware if it is by default.
yes, then you'd submit it to the maintainer ...
and as I thought if is is an external program that is being called to take in this information. then it might fall under user error, unless said user wants to go in and fix that source code.

Last edited by BW-userx; 03-27-2019 at 03:03 PM.
 
Old 03-27-2019, 04:19 PM   #11
Ian M
LQ Newbie
 
Registered: Oct 2017
Posts: 15

Rep: Reputation: Disabled
Quote:
Originally Posted by alan_ri (2.0) View Post
Thanks for the replies so far, folks!
Code:
email: somebody@protonmail.com
I can recreate the problem, in that example it's the colon that makes it fail. It's invalid because /etc/passwd where the info gets stored uses the colon as a field separator. It's the program chfn that is falling over, if you look at the man page it tells you other things to avoid.

Code:
	Home Phone []: 1
	Other []: :
chfn: ':' contains illegal characters
- Warning: an error occurred while setting finger information

Last edited by Ian M; 03-27-2019 at 04:21 PM.
 
3 members found this post helpful.
Old 03-28-2019, 08:30 AM   #12
alan_ri (2.0)
LQ Newbie
 
Registered: Mar 2019
Location: Croatia
Distribution: Debian GNU/Linux
Posts: 6

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Ian M View Post
I can recreate the problem, in that example it's the colon that makes it fail. It's invalid because /etc/passwd where the info gets stored uses the colon as a field separator. It's the program chfn that is falling over, if you look at the man page it tells you other things to avoid.

Code:
	Home Phone []: 1
	Other []: :
chfn: ':' contains illegal characters
- Warning: an error occurred while setting finger information
Yea, you see when I don't have time or whatever to look into something by myself I ask a question on forums like this hoping for a quick reply and in a way that's what forums are about and since Slackware contributor who wrote this script was here maybe he'll fix certain things cause I think it would be good for Slackware in general. That's why I won't mark this thread as solved.

I had my things with Slackware in the past but it was more of a moral issue not a technical issue, though there are. And you almost can't find a distro on Distrowatch I haven't used, tried or tested, but a, Slackware is now my main OS. So let's make it the best it can be!

Sincerely,

Alan
 
Old 03-28-2019, 08:39 AM   #13
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: FreeBSD/Slackware-14.2+/ArcoLinux
Posts: 9,004

Rep: Reputation: 1884Reputation: 1884Reputation: 1884Reputation: 1884Reputation: 1884Reputation: 1884Reputation: 1884Reputation: 1884Reputation: 1884Reputation: 1884Reputation: 1884
As pointed out in detail. This falls under user error. The program that the script is calling that takes in the information for the user has within it a disclaimer or notification on illegal characters, therefore they cannot be used in the information given to a user, and a substitute has to be used in its place.

This has nothing to do with the person that wrote the script adduser that uses the programs that where created by someone else to add a user into the system.

Someone that is a user of an Operating System, the responsibility then falls on same said user to know the limitations of the programs he or she is using within the same said Operating System. Which does require more knowledge then how to use a keyboard.

Therefore the maintainer of this script adduser is not and cannot be held responsible to this issue. Instead it falls upon the user that posted on it under 'user error" and not the developer of same said script.

Therefore, this issue is solved, and should reflect same.

Last edited by BW-userx; 03-28-2019 at 08:48 AM.
 
Old 03-28-2019, 08:45 AM   #14
orbea
Senior Member
 
Registered: Feb 2015
Distribution: Slackware64-current
Posts: 1,713

Rep: Reputation: Disabled
Quote:
Originally Posted by alan_ri (2.0) View Post
Yea, you see when I don't have time or whatever to look into something by myself I ask a question on forums like this hoping for a quick reply and in a way that's what forums are about and since Slackware contributor who wrote this script was here maybe he'll fix certain things cause I think it would be good for Slackware in general. That's why I won't mark this thread as solved.
Fwiw this is a give and take relationship, people who are willing to try to help themselves are much more likely to get useful help here or at pretty much any forum that offers help or advice.
 
Old 03-28-2019, 08:49 AM   #15
drmozes
Slackware Contributor
 
Registered: Apr 2008
Location: Surrey, England
Distribution: Slackware
Posts: 841

Rep: Reputation: 633Reputation: 633Reputation: 633Reputation: 633Reputation: 633Reputation: 633
Quote:
Originally Posted by alan_ri (2.0) View Post
quick reply and in a way that's what forums are about and since Slackware contributor who wrote this script was here maybe he'll fix certain things cause I think it would be good for Slackware in general. That's why I won't mark this thread as solved.
The script works fine - it reports a warning when chfn fails, and you receive the error response directly from chfn -- so you can see for yourself what the issue is. Having the "finger" information set isn't required for an operational account, plus it's too late because the user was already created: it's far outside of the scope of "adduser" to handle removing the account or doing something else to fix it.
There's nothing to fix.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
adduser but no shell and no home dir ryedunn Linux - Newbie 7 09-05-2011 09:52 AM
adduser shell script having some problems. cramer Programming 2 06-10-2006 09:23 PM
Postfix->filter Script->sudo adduser lawtoncooper Linux - General 0 07-23-2004 01:12 AM
adduser script problem svs Programming 1 07-31-2001 02:22 PM
Adduser script Copenhagen Cowboy Programming 0 03-06-2001 09:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 03:04 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration