#50587 Issue 50586 - lib389 - Fix DSEldif long line processing
Closed 3 years ago by spichugi. Opened 4 years ago by spichugi.
spichugi/389-ds-base fix-dseldif  into  master

file modified
+10 -4
@@ -31,11 +31,18 @@ 

              self.path = os.path.join(ds_paths.config_dir, 'dse.ldif')

  

          with open(self.path, 'r') as file_dse:

+             processed_line = ""

              for line in file_dse.readlines():

-                 if line.startswith('dn'):

-                     self._contents.append(line.lower())

+                 if not line.startswith(' '):

+                     if processed_line:

+                         self._contents.append(processed_line)

+ 

+                     if line.startswith('dn:'):

+                         processed_line = line.lower()

+                     else:

+                         processed_line = line

                  else:

-                     self._contents.append(line)

+                     processed_line = processed_line[:-1] + line[1:]

  

      def _update(self):

          """Update the dse.ldif with a new contents"""
@@ -148,4 +155,3 @@ 

              self._instance.log.debug("During replace operation: {}".format(e))

          self.add(entry_dn, attr, value)

          self._update()

- 

Description: When dse.ldif has a very long line inthe attribute value,
it puts it to the next line and adds ' '.
We should process it correctly in lib389.

https://pagure.io/389-ds-base/issue/50586

Reviewed by: ?

just me being super paranoid, this should probably be "dn:"

Will this work if there are 2 or 3 wrapped lines for an attribute? All lines end with "\n" so I'm not sure what this check is actually doing.

just me being super paranoid, this should probably be "dn:"

Sure, I'll fix it.

Will this work if there are 2 or 3 wrapped lines for an attribute? All lines end with "\n" so I'm not sure what this check is actually doing.

This time I was too paranoid and put it as a precaution :D but I guess you a right, it's unlikely that we'll have a line without '/n'. (I am not sure what I was thinking at 1am, hah)

And it will work with 2+ wrapped lines

1 new commit added

  • Fix issues reported by Mark
4 years ago

just me being super paranoid, this should probably be "dn:"

Sure, I'll fix it.

Will this work if there are 2 or 3 wrapped lines for an attribute? All lines end with "\n" so I'm not sure what this check is actually doing.

This time I was too paranoid and put it as a precaution :D but I guess you a right, it's unlikely that we'll have a line without '/n'. (I am not sure what I was thinking at 1am, hah)
And it will work with 2+ wrapped lines

Welllllll..... tiredness (lack of sleep, staying up late) affects your brain worse than alcohol ... so you may as well just work drunk ;)

rebased onto 38d1b0a

4 years ago

Pull-Request has been merged by spichugi

4 years ago

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This pull request has been cloned to Github as issue and is available here:
- https://github.com/389ds/389-ds-base/issues/3643

If you want to continue to work on the PR, please navigate to the github issue,
download the patch from the attachments and file a new pull request.

Thank you for understanding. We apologize for all inconvenience.

Pull-Request has been closed by spichugi

3 years ago
Metadata