Project

General

Profile

Bug #24973

Keep LC_ALL and LANG variables when starting a service

Added by Timur Bakeyev almost 4 years ago. Updated over 3 years ago.

Status:
Resolved
Priority:
Regression
Assignee:
William Grzybowski
Category:
OS
Target version:
Seen in:
Severity:
New
Reason for Closing:
Reason for Blocked:
Needs QA:
No
Needs Doc:
Yes
Needs Merging:
Yes
Needs Automation:
No
Support Suite Ticket:
n/a
Hardware Configuration:
ChangeLog Required:
No

Description

An opposite situation to #24971 - we have a ASCII named dataset, but decided to give SMB share non-ASCII name "раз". The result is different - smb4.conf is created, but it doesn't contain a section, that should correspond to that share.

# smbclient -L localhost
Enter AD\root's password:

        Sharename       Type      Comment
        ---------       ----      -------
        two             Disk
        IPC$            IPC       IPC Service (FreeNAS Server)

        Server               Comment
        ---------            -------
# testparm -v
Load smb config files from /usr/local/etc/smb4.conf
Processing section "[two]" 
Loaded services file OK.
Server role: ROLE_STANDALONE
non-ascii-share-name.png (80.8 KB) non-ascii-share-name.png Timur Bakeyev, 07/03/2017 06:47 PM
bug 24973.png (1010 KB) bug 24973.png Left: Terminal showing the share section in smb4.conf, Center: SMB share with non-ascii character name(Hindi: one two), Right: Ticket Rishabh Chauhan, 08/30/2017 02:01 PM
rcconflocal.png (207 KB) rcconflocal.png confirmation that rc.conf.local contain explicit export LANG=us_US.UTF-8 Rishabh Chauhan, 08/30/2017 02:03 PM
11650
12342
12343

Related issues

Related to FreeNAS - Bug #24590: can't start SMB if shared foldername contains swedish charactersClosed: Duplicate2017-06-17
Related to FreeNAS - Bug #24149: Windows SMB sharingClosed: Duplicate2017-05-24
Related to FreeNAS - Bug #24774: ActiveDirectory did not bind to the domainClosed: Not Applicable2017-06-22
Related to FreeNAS - Bug #23956: SMB failedClosed: Duplicate2017-05-13
Related to FreeNAS - Bug #25538: /usr/local/etc/smb4.conf is not popolated after non ASCII character is found in share nameClosed: Duplicate2017-08-11
Related to FreeNAS - Bug #25600: Accentuated characters in description fields of samba share corrupt smb4.confClosed: Duplicate2017-08-16
Is duplicate of FreeNAS - Bug #24971: non-ASCII shared folder name crashes generation of the smb4.conf fileClosed: Duplicate2017-07-03

Associated revisions

Revision 57591963 (diff)
Added by William Grzybowski almost 4 years ago

Preserve LANG on service(8) calls Ticket: #24973

Revision 57591963 (diff)
Added by William Grzybowski almost 4 years ago

Preserve LANG on service(8) calls Ticket: #24973

Revision f4f97b7e (diff)
Added by William Grzybowski almost 4 years ago

Preserve LANG on service(8) calls Ticket: #24973 (cherry picked from commit 57591963b5e9ac153e481be7fd754bf47ec7fa4f)

Revision f4f97b7e (diff)
Added by William Grzybowski almost 4 years ago

Preserve LANG on service(8) calls Ticket: #24973 (cherry picked from commit 57591963b5e9ac153e481be7fd754bf47ec7fa4f)

Revision f32cfd27 (diff)
Added by William Grzybowski almost 4 years ago

fix(middlewared): set LANG in both middlewared and gui Ticket: #24973

Revision 09187c74 (diff)
Added by William Grzybowski almost 4 years ago

fix(middlewared): set LANG in both middlewared and gui Ticket: #24973 (cherry picked from commit f32cfd27ac532f20e14f6f10d1f867629152d47c)

Revision e4f811ee (diff)
Added by William Grzybowski almost 4 years ago

fix(rc): force LANG on rc system Ticket: #24973

Revision 387412a1 (diff)
Added by William Grzybowski almost 4 years ago

fix(rc): force LANG on rc system Ticket: #24973

Revision ae594cdf (diff)
Added by William Grzybowski almost 4 years ago

fix(middlewared): set LANG in both middlewared and gui Ticket: #24973

Revision 41817322 (diff)
Added by William Grzybowski almost 4 years ago

fix(rc): force LANG on rc system Ticket: #24973

History

#1 Updated by Timur Bakeyev almost 4 years ago

  • Related to Bug #24590: can't start SMB if shared foldername contains swedish characters added

#2 Updated by Dru Lavigne almost 4 years ago

  • Status changed from Untriaged to Unscreened
  • Assignee changed from Release Council to William Grzybowski

As per discussion with Timur, over to William to see if it is a middleware issue.

#3 Updated by William Grzybowski almost 4 years ago

  • Status changed from Unscreened to 15

Not sure what is required from me here.

Do you want directions on how to fix that? Do you want me to fix a SMB stack related problem? Please advise.

#4 Updated by William Grzybowski almost 4 years ago

  • Status changed from 15 to Needs Developer Review
  • Assignee changed from William Grzybowski to Timur Bakeyev
  • Target version set to 11.0-U2

#6 Updated by William Grzybowski almost 4 years ago

  • Subject changed from non-ASCII SMB share name make it disappear from the smb4.conf to non-ASCII SMB share or folder name crashes generation of the smb4.conf file

#7 Updated by William Grzybowski almost 4 years ago

  • Is duplicate of Bug #24971: non-ASCII shared folder name crashes generation of the smb4.conf file added

#8 Updated by William Grzybowski almost 4 years ago

Changes to "os" repo were deemed unnecessary and reverted.

#9 Updated by Timur Bakeyev almost 4 years ago

  • Status changed from Needs Developer Review to Reviewed by Developer
  • Priority changed from Nice to have to Regression

Works as intended.

#10 Updated by Timur Bakeyev almost 4 years ago

  • Related to Bug #24149: Windows SMB sharing added

#11 Updated by Timur Bakeyev almost 4 years ago

  • Related to Bug #24774: ActiveDirectory did not bind to the domain added

#12 Updated by William Grzybowski almost 4 years ago

  • Assignee changed from Timur Bakeyev to William Grzybowski

You also assign back to original assignee after review.

#13 Updated by Vaibhav Chauhan almost 4 years ago

  • Target version changed from 11.0-U2 to 11.0-U3

#14 Updated by an odos over 3 years ago

  • File patch__generate_smb4_conf.py added

I found that the attached patch worked on my systems. Specifically, it allows shares with Cyrillic characters for names. The diff is pretty small.

This issue is affecting several users. I'd rather not be throwing around patched versions of generate_smb4_conf.py on the FreeNAS forums. Is there a way to get this in the next release?

#15 Updated by Timur Bakeyev over 3 years ago

That looks like the patch I came up with :) And I agree, Cyrillic characters are essential!

The problem in general is caused by the fact that service command resets all the process environment, including LC_ALL and LANG variables. That makes processes (re)start with the "C" locale. Here comes the question which fix is more appropriate.

The one, made by William enforces the environment for rc.d/ scripts and solves this problem, as well as other, related to the wrong locale for the start-up scripts. From other side, the fix, you attached makes things work despite the locale. Which is good, but, for example, it doesn't resolve the issue, when mount point has Cyrillic name. And, I guess, there are more corner cases like that.

So, for now I'd prefer William's solution. That should be available with tomorrow's 11.0-U2. And, possibly, we'd make a goal to make whole system locale-neutral.

#16 Updated by an odos over 3 years ago

Timur Bakeyev wrote:

That looks like the patch I came up with :) And I agree, Cyrillic characters are essential!

The problem in general is caused by the fact that service command resents all the process environment, including LC_ALL and LANG variables. That makes processes (re)start with the "C" locale. Here comes the question which fix is more appropriate.

The one, made by William enforces the environment for rc.d/ scripts and solves this problem, as well as other, related to the wrong locale for the start-up scripts. From other side, the fix, you attached makes things work despite the locale. Which is good, but, for example, it doesn't resolve the issue, when mount point has Cyrillic name. And, I guess, there are more corner cases like that.

So, for now I'd prefer William's solution. That should be available with tomorrow's 11.0-U2. And, possibly, we'd make a goal to make whole system locale-neutral.

I thought it was one of the more complex patches I've made. I saw that the target version had been moved to U3 and so I thought it was being bumped back. I came to gripe a bit about it after having someone in the Russian forum indirectly blame me for his broken samba. :-)

#17 Updated by Timur Bakeyev over 3 years ago

You are right, it was shifted to U3 due CVE fix in Samba :( Still, meanwhile you can advertise William's fix instead, that should cover more cases :)

#18 Updated by an odos over 3 years ago

Timur Bakeyev wrote:

You are right, it was shifted to U3 due CVE fix in Samba :( Still, meanwhile you can advertise William's fix instead, that should cover more cases :)

To clarify: you're referring to this fix, correct? https://github.com/freenas/freenas/commit/387412a13c6833a748773434ffb53393a8e9eac1

#19 Updated by Timur Bakeyev over 3 years ago

Yes, as simple as that.

#20 Updated by Timur Bakeyev over 3 years ago

  • Assignee changed from William Grzybowski to Release Council

#21 Updated by Timur Bakeyev over 3 years ago

#22 Updated by William Grzybowski over 3 years ago

  • Assignee changed from Release Council to William Grzybowski

#23 Updated by Vaibhav Chauhan over 3 years ago

please publish your changes in a PR which will be merged against stable branches, also please let us know here when you have PR ready.

#24 Updated by Vaibhav Chauhan over 3 years ago

  • Status changed from Reviewed by Developer to 47

#25 Updated by Dru Lavigne over 3 years ago

  • Related to Bug #25538: /usr/local/etc/smb4.conf is not popolated after non ASCII character is found in share name added

#26 Updated by Bonnie Follweiler over 3 years ago

  • Related to Bug #25600: Accentuated characters in description fields of samba share corrupt smb4.conf added

#27 Updated by Dru Lavigne over 3 years ago

  • Subject changed from non-ASCII SMB share or folder name crashes generation of the smb4.conf file to Keep LC_ALL and LANG variables when starting a service

#28 Updated by Joe Maloney over 3 years ago

  • Assignee changed from William Grzybowski to Rishabh Chauhan

#29 Updated by Rishabh Chauhan over 3 years ago

12342
12343

I created an SMB share with a name in Hindi character (non-ascii) "दो तीन" which means "one two" in hindi. and the following image explains it all.
Left: Terminal showing the share section in smb4.conf, Center: SMB share with non-ascii character name(Hindi: one two), Right: Ticket
After discussing with Timur I confirmed that /conf/base/etc/rc.conf.local contains explicit export LANG=us_US.UTF-8.

#30 Updated by William Grzybowski over 3 years ago

  • Assignee changed from Rishabh Chauhan to William Grzybowski

#31 Updated by Vaibhav Chauhan over 3 years ago

  • Status changed from Ready For Release to Resolved

#32 Updated by Dru Lavigne about 3 years ago

  • File deleted (patch__generate_smb4_conf.py)

Also available in: Atom PDF