Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug in logfile parsing #42706

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

Matthew-Whitlock
Copy link
Contributor

Spack occasionally parses escape sequences incorrectly, leading to confusing chunks of missing text. This replaces the magic code with a more comprehensible regex that aligns with ANSI standards.

@spackbot-app spackbot-app bot added core PR affects Spack core functionality utilities labels Feb 15, 2024
@wdconinc
Copy link
Contributor

Rebased for updated audit and style checks. Can you please post a reproducer of the kind of issue that is solved by this PR?

@wdconinc wdconinc self-assigned this May 19, 2024
@spackbot-app spackbot-app bot added the tests General test capability(ies) label Jun 5, 2024
@Matthew-Whitlock
Copy link
Contributor Author

Can you please post a reproducer of the kind of issue that is solved by this PR?

@wdconinc I've just added a test case with a sample string. On my system, I get that sample string from gcc without any customization to GCC_COLORS etc.

As a larger example, when I break some template-heavy code and try building it, I get the following raw output (copied from vim, so ^[ is an escape key):

/home/mwhitlo/vt-prs/traits/examples/../src/checkpoint/dispatch/dispatch_serializer_nonbyte.h: In instantiation of '^[[01m^[[Kvoid checkpoint::dispatch::SerializerDispatchNonByte<SerializerT, T, Dispatcher>::^[[01;32m^[[Kapply^[[m^[[K(SerializerT&, T*, checkpoint::SerialSizeType, hasNotVirtualSerialize<U>*) ^[[35m^[[K[with U = test::TestObj; SerializerT = checkpoint::SerializerRef<checkpoint::Sizer, checkpoint_trait>; T = test::TestObj; Dispatcher = checkpoint::dispatch::BasicDispatcher<checkpoint::SerializerRef<checkpoint::Sizer, checkpoint_trait>, test::TestObj>; checkpoint::SerialSizeType = long unsigned int; hasNotVirtualSerialize<U> = test::TestObj]^[[m^[[K^[[m^[[K':               
^[[01m^[[K/home/mwhitlo/vt-prs/traits/examples/../src/checkpoint/dispatch/dispatch_serializer_nonbyte.h:81:10:^[[m^[[K   required from '^[[01m^[[Kvoid checkpoint::dispatch::SerializerDispatchNonByte<SerializerT, T, Dispatcher>::^[[01;32m^[[Koperator()^[[m^[[K(SerializerT&, T*, checkpoint::SerialSizeType) ^[[35m^[[K[with U = test::TestObj; SerializerT = checkpoint::SerializerRef<checkpoint::Sizer, checkpoint_trait>; T = test::TestObj; Dispatcher = checkpoint::dispatch::BasicDispatcher<checkpoint::SerializerRef<checkpoint::Sizer, checkpoint_trait>, test::TestObj>; checkpoint::SerialSizeType = long unsigned int]^[[m^[[K^[[m^[[K'

Spack's current output file give me lines like so

/home/mwhitlo/vt-prs/traits/examples/../src/checkpoint/dispatch/dispatch_serializer_nonbyte.h: In instantiation of '^[[K':     
e/mwhitlo/vt-prs/traits/examples/../src/checkpoint/dispatch/dispatch_serializer_nonbyte.h:81:10: '^[[K'     
e/mwhitlo/vt-prs/traits/examples/../src/checkpoint/dispatch/dispatch_serializer_byte.h:79:13: '^[[K'     
e/mwhitlo/vt-prs/traits/examples/../src/checkpoint/dispatch/dispatch.impl.h:159:5: '^[[K'     
e/mwhitlo/vt-prs/traits/examples/../src/checkpoint/dispatch/dispatch.impl.h:181:7: '^[[K'                                                                                    
e/mwhitlo/vt-prs/traits/examples/../src/checkpoint/dispatch/dispatch.impl.h:197:41: '^[[K'                                                                                                                                                              
e/mwhitlo/vt-prs/traits/examples/../src/checkpoint/dispatch/dispatch.impl.h:270:68: 'plReturnType checkpoint::dispatch::plReturnType = std::tuple<std::unique_ptr<checkpoint::buffer::Buffer, std::default_delete<checkpoint::buffer::Buffer> >, long unsigned int>; checkpoint::BufferObtainFnType = std::function<char*(long unsigned int)>]^[[K'          
e/mwhitlo/vt-prs/traits/examples/../src/checkpoint/checkpoint_api.impl.h:58:51: '^[[K'     
e/mwhitlo/vt-prs/traits/examples/checkpoint_example_user_traits.cc:11:76: here     
e/mwhitlo/vt-prs/traits/examples/../src/checkpoint/dispatch/dispatch_serializer_nonbyte.h:233:16:atching function for call to '^[[K'                                                                                                
  233 |     )^[[K;                                                                             
      |     ^[[K

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core PR affects Spack core functionality tests General test capability(ies) utilities
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants