[GH-ISSUE #168] Bash For loop in ListAction.sh breaks -d domain full backup of zmbackup with domains that have the letter 's' on them #135

Open
opened 2026-02-27 08:14:31 +03:00 by kerem · 4 comments
Owner

Originally created by @krull on GitHub (Oct 8, 2021).
Original GitHub issue: https://github.com/lucascbeyeler/zmbackup/issues/168

ISSUE TYPE
  • Bug Report
ENVIRONMENT VERSION
  • Zmbackup Version: 1.2.6
  • Zimbra Version: 8.8.15_GA_3945.FOSS
  • Linux Distribution & Version: Ubuntu 18.04.4 LTS
SUMMARY
build_listBKP()
line: /usr/local/lib/zmbackup/bash/ListAction.sh:25

build_listRST()
line: /usr/local/lib/zmbackup/bash/ListAction.sh:64

Bash For loop in ListAction.sh breaks -d domain full backup of zmbackup with domains that have the letter 's' on them

STEPS TO REPRODUCE
zmbackup -f -d thesdomain.tld

with #!/bin/bash -x, the result above will have an output:

+ for i in ${4/\s/\n/g}
+ DC=,dc=
+ DOMAIN=dc=then/gdomain,dc=tld
+ ERR='++ ldapsearch -Z -x -H ldap://127.0.0.1:389 -D uid=zimbra,cn=admins,cn=zimbra -w XXXXXXXX -b dc=then/gdomain,dc=tld -LLL '\''(objectclass=zimbraAccount)'\'' zimbraMailDeliveryAddress
No such object (32)
Matched DN: dc=tld'
+ BASHERRCODE=32

ACTUAL RESULTS
tail -f /var/log/syslog

Oct  8 07:55:03 zmb-mbox00 zimbra[31431]: Zmbackup: LDAP - Can't extract accounts from LDAP - Error below:
Oct  8 07:55:03 zmb-mbox00 zimbra[31432]: Zmbackup: No such object (32)#012Matched DN: dc=tld
Originally created by @krull on GitHub (Oct 8, 2021). Original GitHub issue: https://github.com/lucascbeyeler/zmbackup/issues/168 <!-- Before open an issue, please remember to check our Google Group (link in README.md) and the other issues. Maybe what you want is already answered. You don't need to answer all the questions below, just answer what is pertinent to what you want (You don't need to explain the steps to reproduce and the results if your issue is about the documentation) --> <!-- ISSUE TYPE: Inform what kind of issue we are talking about. Choose only one option. --> ##### ISSUE TYPE - Bug Report <!-- ENVIRONMENT VERSION: Describe the environment you are using the Zmbackup and its version. --> ##### ENVIRONMENT VERSION - Zmbackup Version: 1.2.6 - Zimbra Version: 8.8.15_GA_3945.FOSS - Linux Distribution & Version: Ubuntu 18.04.4 LTS <!-- SUMMARY: Describe your issue in this field. The more detailed you gave us, more easy and fast will be for us to debug and fix the software. --> ##### SUMMARY ``` build_listBKP() line: /usr/local/lib/zmbackup/bash/ListAction.sh:25 build_listRST() line: /usr/local/lib/zmbackup/bash/ListAction.sh:64 ``` Bash For loop in ListAction.sh breaks -d domain full backup of zmbackup with domains that have the letter 's' on them <!--- SUMMARY:For bugs, show exactly how to reproduce the problem, using a minimal test-case. For new features, show how the feature would be used. --> ##### STEPS TO REPRODUCE ``` zmbackup -f -d thesdomain.tld ``` with `#!/bin/bash -x`, the result above will have an output: ``` + for i in ${4/\s/\n/g} + DC=,dc= + DOMAIN=dc=then/gdomain,dc=tld + ERR='++ ldapsearch -Z -x -H ldap://127.0.0.1:389 -D uid=zimbra,cn=admins,cn=zimbra -w XXXXXXXX -b dc=then/gdomain,dc=tld -LLL '\''(objectclass=zimbraAccount)'\'' zimbraMailDeliveryAddress No such object (32) Matched DN: dc=tld' + BASHERRCODE=32 ``` <!-- ACTUAL RESULTS: What happened when you did the steps before. --> ##### ACTUAL RESULTS ``` tail -f /var/log/syslog Oct 8 07:55:03 zmb-mbox00 zimbra[31431]: Zmbackup: LDAP - Can't extract accounts from LDAP - Error below: Oct 8 07:55:03 zmb-mbox00 zimbra[31432]: Zmbackup: No such object (32)#012Matched DN: dc=tld ```
Author
Owner

@krull commented on GitHub (Oct 8, 2021):

Hello,

This bug report was reproduced with the following; I have several domains that include the letter 's' and ones without.

The ones without successfully backup, however the ones with 's' did not.

I remedied the issue by changing the following in ListAction.sh file:

for i in ${4//\n/g}; do

Not certain if it will break other logics on your script, but it passed correctly the domain with 's' to the ldapsearch command.

hope this helps.

-krull

<!-- gh-comment-id:938461194 --> @krull commented on GitHub (Oct 8, 2021): Hello, This bug report was reproduced with the following; I have several domains that include the letter 's' and ones without. The ones without successfully backup, however the ones with 's' did not. I remedied the issue by changing the following in `ListAction.sh` file: ```` for i in ${4//\n/g}; do ```` Not certain if it will break other logics on your script, but it passed correctly the domain with 's' to the ldapsearch command. hope this helps. -krull
Author
Owner

@tofuSCHNITZEL commented on GitHub (Aug 30, 2022):

it also breaks if there is an "n" in the email adress because it gets substituted with g. "\s" and "\n" does not not work with bash substitution.
you can check out the proper fix here:
github.com/tofuSCHNITZEL/zmbackup@d5028344fe

<!-- gh-comment-id:1231857295 --> @tofuSCHNITZEL commented on GitHub (Aug 30, 2022): it also breaks if there is an "n" in the email adress because it gets substituted with g. "\s" and "\n" does not not work with bash substitution. you can check out the proper fix here: https://github.com/tofuSCHNITZEL/zmbackup/commit/d5028344feb83342d73e5977dfc138c404a913cc
Author
Owner

@milauria commented on GitHub (Aug 28, 2024):

The version 1.2 still present this issue and these changes resolve the issue.
Can somebody release this changes into a new release 1.3 ?

<!-- gh-comment-id:2315337190 --> @milauria commented on GitHub (Aug 28, 2024): The version 1.2 still present this issue and these changes resolve the issue. Can somebody release this changes into a new release 1.3 ?
Author
Owner

@tofuSCHNITZEL commented on GitHub (Aug 28, 2024):

The version 1.2 still present this issue and these changes resolve the issue. Can somebody release this changes into a new release 1.3 ?

you can just clone and use my fork:
https://github.com/tofuSCHNITZEL/zmbackup

<!-- gh-comment-id:2315344116 --> @tofuSCHNITZEL commented on GitHub (Aug 28, 2024): > The version 1.2 still present this issue and these changes resolve the issue. Can somebody release this changes into a new release 1.3 ? you can just clone and use my fork: https://github.com/tofuSCHNITZEL/zmbackup
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/zmbackup#135
No description provided.